Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Alexa unRAID voice control How-To

Featured Replies

Here is how to get Alexa to control your server (IE: have Alexa start up a VM / docker container etc).  This is all geared towards using a free Dropbox account as the cloud server and Alexa, but the concept would be the same for any other cloud storage providers (provided you can mount the cloud storage location) and Google Assistant.  You probably also need to use the same login as you would for your Alexa account.  (I just used "login via google" for everything listed here, which matches my alexa account)

 

 

image.png.dcc31754989486b0f83361c072f99704.png

 

  • You must however change the host path for the Data Files from it's default of /mnt/user/Dropbox to instead be /mnt/cache/Dropbox (dropbox will not work if it's not pointed directly at a drive), with an access mode of RW:SLAVE

 

image.thumb.png.7109c10f1ca7ea3a83f5b228ef9c4300.png

 

  • Start the dropbox application, and view the logs for it.

image.png

 

 

  • In the logs there will be a line similar to

 

image.png.ebb1ec6c9b52f1129240a9d680112ee8.png

 

  • Go to the URL and connect the server to your account
  • Set Dropbox to autostart
  • Go to https://ifttt.com/join and create a free account
  • Go to Create

 

image.png.c4e2037695e3180248feb71de1a6ba94.png

 

  • Click the Plus sign

 

image.thumb.png.67ba6e0c337a1cdeb02867a5d7497284.png

 

  • Select Amazon Alexa

 

image.png.3e2c54177acdb96ae39d2fc2a4f3d499.png

 

  • Select Say A Specific Phrase

 

image.png.00db6cb8c58bcaf7d4bc07379a43d59b.png

 

  • Tell Alexa what to listen for and create the trigger

 

image.png.be27a714f6ddd660e04fb515976beb3c.png

 

  • Click the Plus Sign

 

image.thumb.png.707c4c32ce1ea29caa449d0f04f1c875.png

 

  • Choose Dropbox and create a text file

 

image.png.5b42ff457e55f7a68c5725593b9af17a.pngimage.png.5c1583cc209c1c8d6a7e075b93646c34.png

 

  • In the box, the "content" is the command to be executed.  If you're running multiple commands, then I would suggest executing them as a script ie: content would be 
/bin/bash /boot/my_scripts/mytestscript.sh
  • Set the dropbox folder path to be unraid_actions  Then click create action  (In this example, we're just going to write "This is a test" into the syslog

 

image.thumb.png.222376339a863c507f4cfbe8be79b546.png

 

 

  • Using the User Scripts plugin (if already installed, then make sure that it's up to date), set up the following script to run at First Array Start Only

 

#!/usr/bin/php
<?
  for ( ;; ) {
    exec("inotifywait /mnt/cache/Dropbox/unraid_actions > /dev/null 2>&1",$out,$err);
    if ($err) { sleep(10); continue; }
    foreach (glob("/mnt/cache/Dropbox/unraid_actions/*.txt") as $file) {
      exec("logger ".escapeshellarg("Executing Voice Command ".file_get_contents($file)));
      passthru("/bin/bash ".escapeshellarg($file));
      unlink($file);
      for ( ;; ) {
       sleep(1);
       if ( ! is_file($file) ) break;
      }
    }
  }
?>

 

  • Enter in the following command at the terminal  (If you don't do this, then it will miss the first trigger ever given)
mkdir -p /mnt/cache/Dropbox/unraid_actions
  • Reboot the server and test what you've created
Quote

Alexa, trigger this is a test

 

Apr 23 08:40:27 unraidA root: Executing Voice Command logger this is a test
Apr 23 08:40:27 unraidA root: this is a test

 

Success!

 

Now you can create any given command you want for Alexa to be able to execute on your server.  IE: you can start a VM with the appropriate virsh commands, start a docker container, etc etc etc.  Enjoy

 

 

DANGER ZONE:

 

DO NOT USE A DROPBOX where other people have write access to it (ie: make sure that no one else can place a file into unraid_actions).  This script will execute ANY file placed into unraid_actions, and if/when your kids get annoyed at you, there is nothing stopping them from deleting the contents of your array.  Only use drop box where you are in 100% complete control of.

 

To avoid this problem, you could expand the user scripts script to actually read what's in the file (say the contents are Start VM) and then it issues the appropriate command itself.  I'll leave the customization up to you guys.  Something akin to

#!/usr/bin/php
<?
  for ( ;; ) {
    exec("inotifywait /mnt/cache/Dropbox/unraid_actions > /dev/null 2>&1",$out,$err);
    if ($err) { sleep(10); continue; }
    foreach (glob("/mnt/cache/Dropbox/unraid_actions/*.txt") as $file) {
      $command = trim(file_get_contents($file));
      exec("logger ".escapeshellarg("Executing Voice Command $command"));
      switch ($command) {
        case "test":
          exec("logger this is a test");
          break;
        case "start VM":
          exec("virsh.....");
          break;
        case "start plex":
          exec("docker start plex");
          break;
        default:
          exec("logger ".escapeshellarg("unknown voice command $command"));
          break;
      }
      unlink($file);
      for ( ;; ) {
        sleep(1);
        if ( ! is_file($file) ) break;
      }
    }
  }
?>

 

  • Author

Hopefully I didn't miss any steps ;)   And also, don't delete the unraid_actions folder from your dropbox.  If you do this, then it will miss the first trigger given to Alexa

  • 1 year later...

Anyone got this or a similar solution for google assistant? I got wake on lan working (asus router + ifttt + google assistant) but now I'm looking to send the unRaid server to sleep in a similar fashion.

  • Author

iffft has the same applets available for Google as it does for Alexa.   This was mostly a POC as I was curious (and bored)

  • 8 months later...

Hi Squid, I actually used the "Dropbox-otherguy" mgutt's repo for this.. as i can't make the other work. 


I got into "Syncing..." in the container log but i don't receive my text file inside my share folder. any advise  ?

  • Author

This was something I did 2 years ago on a whim and have never looked at it (or used it since)  Basic procedure I would think would remain the same.

Hi Squid, thanks. 


I actually tried removing the DROPBOX_SKIP_UPDATE value from the container settings. and made sure set the "Dropbox" share set to Cache setting to "No" and just tried restarting the container, and everything worked already. 

 

just circling back to share what was done to make the container work. 

 

Edit: for me this is very helpful because i don't have to do any WOL or VPN in the Server to turn on my windows VM. I can just let the kids know what to say to have the Windows VM start.  

thank you again for the guide.

Edited by baby0nboardInSg

  • 1 year later...

Thanks, still works! I'm doing the bare minimum of turning a VM on and off, but it does the trick and thankfully doesn't cost me anything (I'm subscribed to more than enough already)

 

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.