Hibernating a Synology NAS with RoonServer installed

Update Rewrote this tutorial for the updated “Workflow” app which is now known as (Siri) “Shortcuts”.

I wrote this tutorial for those that, just like me, are not to fond of having their NAS devices run all day without going into hibernation. In this tutorial we are going to write a script with the app called “Shortcuts” that will allow us to start/stop the RoonServer package on our Synology NAS with a single press of a button on our iOS devices. This will allow your NAS to go into hibernation mode when not using Roon. But also to quickly start it when we want to listen to some music.

These buttons/scripts will let you start/stop RoonServer on your Synology NAS. You could also turn off

In this case pressing the Start button will instruct my NAS to start the RoonServer package, and the Stop button will instruct it to stop the package. Which will allow my NAS to go into hibernation.

I assume that you have some basic knowledge with Linux commandline language, if not you can find plenty about it on the internet. If you think this is abracadrabra then you should probably take a pass on this as it can easily screw up your NAS.

In order to be able to use the Workflow buttons to start/stop Roon the following modification needs to be made to the sudoers file on your NAS otherwise the superuser command in “Shortcuts” will grant the following error message:

Error 54 sudo: no tty present and no askpass program specified.

The reason for this is that the Shortcuts app cannot run superuser commands that require passwords. Luckely for us we can alter the need of a password for commands that need superuser priviliges. This might sound complex but in fact its really simple and fairly easy to accomplish. Just be aware that we need to edit the sudoers file which contains some vital information and you should be VERY CAREFULL editing this file. I take no responsibility in anyway so the following part of this tutorial is your own responsibility. If you have any doubts about wether you should edit the sudoers file or don’t have any experience editing files like these in linux I advise you to quit and just wait untill Crieke may fix the hibernation problem. If above does not apply to you or you are just feeling adventurous but understand the possible risks you can read on.

Alrighty, first off all lets start with what you need. I am using IOS and MacOS devices, so this tutorial is focussing on those devices. Offcourse there are Windows equivalents, so you can probably use the head liners of this tutorial and translate them into Windows software bits.

For iPhone or iPad you need the following apps: Shortcuts
On your MacBook or iMac: Terminal (MacBook comes installed with this app)

  1. Open Terminal on your MacOS device and ssh into your Synology NAS. This can be done by entering the following command:

ssh (account name)@(synology ip adress)

in my case:

ssh Tinus@192.168.1.2

  1. You should now be prompted for your Synology account password, type your password and hit enter. Notice that will not be able to see your typed characters.
  2. Now lets modify the sudoers file. Note that i am using vi to edit the file. If you are unfamiliar with vi please use google to look for instructions. Modify the sudoers file by entering the following command:

sudo vi /etc/sudoers

Once again you will be prompted for your password, enter it and press enter.

  1. You will now be inside the sudoers file. Add the following line to the end (again if you don’t know what that means please do some research on the internet):

username ALL = NOPASSWD: /usr/syno/bin/synopkg start RoonServer, /usr/syno/bin/synopkg stop RoonServer

Where username is your synology account name with administrator rights. In my case:

Tinus ALL = NOPASSWD: /usr/syno/bin/synopkg start RoonServer, /usr/syno/bin/synopkg stop RoonServer

  1. Save and close your edited sudoers file. If it gives you a warning that it is read only you can force save by typing the following command:

:w!

followed by

:q

  1. We are done with the hard part, to exit the secure shell type:

exit

  1. Open the App Store and download and install Shortcuts on your iOS device.

  1. When you are in the main menu you can create your RoonServer workflow. In the library tab press the “+” button in the top right corner. Afterwards a nameless shortcut will be created.
  2. You can press the “switches” button to modify the name of the shortcut and pick a color plus icon. You can even enable Siri and add a passphrase to control the activity by using Siri.
  3. Back in the shortcut creation screen go to the search pane and type in “choose” and press on the script called “Choose from menu”.

  1. You will notice that the app pasted a “Choose from menu” prompt with description “One” and “Two”. You can rename these Start and Stop ie. or whatever name you want to give the actions, by pressing on the names. Underneath this window you will notice that the name you gave these actions have a corresponding field underneath the “Choose from Menu” prompt we just created.

  1. Next up we are gonna add a “Run Script over SSH” action. So search this activity in the search pane and press on it. It will appear on the bottom of your activity. Press and hold on the “Run Script Over SSH” box and drag in underneath the “Start” pane. Repeat this process and add a similar SSH script underneath the “Stop” bar.

  1. Next up we need to configure the SSH script to start and stop the Roonserver. The Run Script Over SSH box has some information which need to be filled in.
    Host: requires you to specify the IP-adres of your NAS device. I recommend giving your NAS a static IP adress. Otherwise the usability of the created buttons will be limited.
    Port: Your SSH port, unless you have altered the port in your Synology this should be 22.
    User: The accountname that has admin rights on your Synology device and which you used in step 4.
    Password: The password of the account you specified under user.
    Script: You will need to type the following command line:

sudo /usr/syno/bin/synopkg start RoonServer

  1. Next up type “open app” in the search pane and press on “Open App”. Drag the “Open App” box underneath the “Run Script Over SSH” in the “Start” part of the shortcut. Afterwards press “Choose” and select the Roon app in the list.

  1. Now we have arrived to the Stop part of the script.
    Host, Port, User and Password are the same as you used at step 13
    Script: This time you will need to type the following command line:

sudo /usr/syno/bin/synopkg stop RoonServer

  1. Press “Done” in the upper right corner.

  1. Your shortcut is now saved and you can add the “Shortcuts” widget on your widget screen by swiping to the right on your home page.
  2. Enjoy!
6 Likes

Thanks, wasn’t aware of Workflow.

Is there a way to do the same on an Android phone?

Anything new on this ?

I’m new with roon.
It’s a very fine software.

But it is very disappointing that my synology NAS must stay on whole time

Hello,
Would you be able to update the pocedure to work with the new Shortcuts 2.0?
Workflow no longer exists for IOS devices.
Thanks!
Yves

Hello @iefbo its practically the same. However IFTTT is no longer natively supported. You could create web hooks on the IFTTT website and run those to allow control with for example a Harmony remote.

Well, honestly I get stuck at step 1.
What shortcut should I create?

I wanted to update my tutorial for you but somehow I am no longer to edit my own post.

@andybob I am no longer allowed to edit the tutorial I posted in this topic. Could you grant me permission to edit so I can update my tutorial?

Hi @Anthro,

Discourse has a cut off date for users editing own posts, I think it’s 3 months on this Forum. This date can be changed for the Forum as a whole but it opens up potential abuses which the Admins prefer to avoid.

I’ll copy the existing tutorial into a PM to you. You can then edit it. If you have your own web page then a link to the tutorial is best, as you’ll be able to keep it up to date. If not, then I’ll paste it back into the thread.

I’m down the beach atm where the Internet is wonky, so will send the PM in about 12 hours when I’ll be back in civilisation.

Cheers,

Oh my, is there really no easier way for this to happen? I just now am realizing my Synology is not sleeping, and probably hasn’t not slept since I put the Roon services on it.

I’d think it would be easy for Roon to know when no end point is making calls to it for a certain amount of time, and then allow the NAS to go into low power mode after that?

yeah, you would think, huh …
but many users have asked for it for over a year …
also the developer of the Roon for synology solution has looked into it, but could not work around it …
For now seems like disabling Roon is the only option

The first post in this thread has been updated with @Anthro’s edited tutorial.

@iefbo I have updated the tutorial.

@Anthro now that is what I call super service!!! :grinning:

THANK YOU!!!

You are welcome :grinning: