How to set up Volumio to reboot nightly

I have a Raspberry Pi 3B that has been running Volumio for a couple of years through various versions of the OS. I use it exclusively as a DLNA renderer. The biggest issue I’ve had is stability when idle. If I don’t use the machine for a few days in a row, which is common, it becomes unresponsive and I have to unplug it and replug it in to reboot it.

I don’t know if it is a hardware issue or network issue or a problem in the OS, but I finally took some time to set up a cron job to reboot the machine in the middle of the night every night. This is a heavy-handed solution but in the couple of months since I made the change I’ve only had to reboot it manually once. A huge improvement.

I’m new at a lot of this–I didn’t know what cron even was–so I’m documenting this here for other newbies (and for myself in the future if I ever need to do it again).

  1. Enable SSH here: ipaddress/dev
  2. Download PuTTY on my Windows machine.
  3. Connect PuTTY to ipaddress with username and password volumio.
  4. sudo nano /etc/crontab
  5. Enter password again.
  6. Down arrow to the lowest hash (#). ENTER to lower it, then up arrow to edit between them.
  7. Add the following line: 00 8 * * * root reboot
  8. CTL-X to exit, then Y to save changes and ENTER to accept default file name.

The 00 8 at the beginning of the new line sets the time of the reboot at 0800. When I was testing the reboot code, I first set the reboot to just a few minutes ahead of the current time, which is how I discovered that my Pi with Volumio isn’t set to my current timezone; it’s on Universal Time. Rather than figure out how to change the timezone, I just set it to reboot at 0800 UT, which is the middle of the night here.

I haven’t upgraded Volumio since I made this change; I’m not sure if it will be wiped out on upgrade.

Anyway, leaving here for others or for suggestions of other ways to deal with the problem.

Thanks for sharing! I was looking for this solution as well.
In my case (I use volumio to play Internet radio only) it happens that when I stop playing any radio station before night, next day when I click on “play” button, nothing happens, simply there’s no sound. Manual restart does help.
Did you face similar issue?

My issue sounds different. I only use my system as a DLNA renderer, and the whole system (not just the Volumio UI) seems to become unresponsive if I don’t use it for a number of days. But, yeah, setting up a nightly reboot may solve your problem as well.

Can’t get it to work, have tried the steps exactly. Experimented with UT and local timezone.

If you’d like to change your timezone, should be working using steps from
audiophonics.fr/en/blog-diy … lumio.html

Tried to check with crontab -l if something was planned, but nope. If anyone would like to understand a bit more on how to edit cron… raspberrypi.org/documentati … ge/cron.md

Somebody any clues on how to get this fixed? Using volumio with balbuzes connect plugin regularly “disappears” which is only solved via a reboot. Hoping a regular reboot fixes the issue.

If it helps anyone, I just made a fresh Volumio install and got nightly shutdowns to work without problem. (But I use UTC time and haven’t cared about local timezone)

  1. Install cron:

sudo apt-get update sudo apt-get install -y cron
2. Configure:

crontab -e

Added this line for a shutdown at 22:30 UTC:
30 22 * * * /volumio/app/plugins/system_controller/volumio_command_line_client/commands/playback.js shutdown
Save and exit with Ctrl-x y

I haven’t found any documentation, but replacing ‘shutdown’ with ‘reboot’ seems to give the expected behavior.

Hey, thanks for that, akbo. That sounds more elegant than my original solution and I’ll give it a try.

I just implemented this but had a slightly different experience.

  • To install crontab I used sudo apt-get install -y cron
  • Changed the cronjob to 00 07 * * * /volumio/app/plugins/system_controller/volumio_command_line_client/commands/playback.js reboot

example:
___
/_ \ __
__ __ //\ \ __ __ ___ ___ /_\ ___
/\ /\ \ / __\\ \ \ /\ \/\ \ /' __ __\/\ \ / __\
\ \ _/ |/\ \L\ \
\ _\ \ _\ /\ /\ /\ \ \ /\ \L\
\ _
/ \ _//_\ _/\ _\ _\ _\ _\ _/
// // // // /////////___/

         Free Audiophile Linux Music Player - Version 2.0

      C 2015 Michelangelo Guarise - Volumio Team - Volumio.org

Volumio Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
volumio@volumio:~$ sudo apt-get install -y cron
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed

============
volumio@volumio:~$ crontab -l
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use ‘*’ in these fields (for ‘any’).#
# Notice that tasks will be started based on the cron’s system
# daemon’s notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
#
# * * * * * CMD
# 1 2 3 4 5 6
# | | | | | |
# | | | | | ± Command to run
# | | | | ±— Day of the Week (range: 0-6, 1 standing for Monday)
# | | | ±----- Month of the Year (range: 1-12)
# | | ±------- Day of the Month (range: 1-31)
# | ±--------- Hour (range: 0-23)
# ±----------- Minute (range: 0-59)
#
# The below command was entered on 3/26/2021 to perform nighly reboots
#
00 07 * * * /volumio/app/plugins/system_controller/volumio_command_line_client/commands/playback.js reboot
volumio@volumio:~$

seems to be working based on uptime

Volumio Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
volumio@volumio:~$ uptime -s
2021-03-27 07:00:14

Thanks for posting this - I’ve been tearing my hair out with my pi 2B loosing the network - thought it was a wifi issue so switched to wired lan and the problem persists - incredibly frustrating!

Sounds like others have similar issues any thoughts on a solution beyond the sledgehammer approach?

I’ll see if I can figure out the instructions above and give it a whirl.

Many thanks,

Robert

Had a look at all the instructions above and finding them to be all opaque to me lol.

I love using volumio & my pi (when it works it’s great) but feel that for the times when things go wrong having to relearn how to do all this stuff again and again is just too much… the draw of the dark side of commercially available streamers feels very strong!

Are you able to SSH into the device?

It’s really not very difficult, but if you’ve got £/$/E1000s to blow, then go for it. :innocent: Alternatively, you could ask for help and clarification of stuff that you don’t understand. One of the things I like about Volumio is that it’s community is very happy to give help and advice on stuff from the basics of linux single board computers such as the RPi, right up through the experience of how to achieve great sound from your hardware whatever your budget.

Just for a first pointer if you’re looking for a comparable experience to commercial streamers, then please invest a tiny bit more in a more capable RPi than RPi2, or one of the x86 mini-PC boxes available.

Edit: ok for my example of a daily, clean reboot…

There is an error in this post, please go here for further details.

  1. Enable & access your RPi by ssh (this is simply a way of talking directly to your RPi through the command line.

https://volumio.github.io/docs/User_Manual/SSH.html

  1. Make a systemd timer file in /etc/systemd/system:
sudo nano /etc/systemd/system/systemd-reboot.timer

Add the following content and press CTRL-O to write the file, followed by CTRL-X to return to the command line. [Edit: please note that here I originally wrote “CTRL Z to save it.”]

[Unit]
Description=Reboot daily at 1am

[Timer]
OnCalendar=*-*-* 1:00:00

[Install]
WantedBy=timers.target

  1. Enable the timer & start it:
sudo systemctl enable /etc/systemd/system/systemd-reboot.timer
sudo systemctl start /etc/systemd/system/systemd-reboot.timer

Done, your RPi should reboot daily at 1.00am :wink:

Edit 2: to anyone wanting to get into writing plugins for Volumio, this simple rebooter would be a great first project to get used to how plugins are produced/work in Volumio. You just need to understand how the above timer file can be incorporated into Volumio’s plugin structure.

More information on writing plugins can be found here.

1 Like

Hi,

Many thanks for the reply!

Are you thinking an upgrade to a Rpi4 would help things?

Thank you also for the instructions for the automatic reboot - I’ll take a look and see if I can figure the steps out. I’m not a natural at this so each time something goes wrong it feels like I’m starting from scratch and having to relearn how to dabble in the rpi code. I know I can do it and have done in the past but… well you know, ultimately I just want to be able to sit down and listen to my tunes. (Ps my sd card now keeps being corrupted - arghh)

Thanks though,

Robert

Lots of people use the older Pis quite happily, and although I have retired all my 1s & 2s, I run a couple of RPi0s with Volumio … it’s a matter of expectations. An upgrade to a RPi4 would certainly lead to a much more responsive experience. RPi3s would be fine, but since they’re all at a similar price-point, why not got for the RPi4. The only thing to watch for with the RPi4 is that you get a decent 3A power supply.

Let us know how you get on. :wink:

P.S. if you’re getting the sd corruption on multiple cards, then this might be a result of poor power supply.

1 Like

hi - sd card rebuilt and the tunes return… immediate reduction in stress… right - ssh…

Ok - so, downloaded openssh from the link under SSH on the volumio documentation but no idea how to install the software (I’m guessing that it is software to install) on my macbook… sorry for being a pain but you might be starting to pick up on how much of a struggle this is for me! I have looked through all of the files that downloaded but nothing leaps out at me - under pc/windows I’m thinking that this would be an .exe file?

Am I right in thinking that openSSH is a small programme that allows access to the Rpi from my mac and so allows me to ammend the volumio code to include the instruction to reboot at 1am?

No need to download any software. Your Mac should already be capable of using ssh directly. Have a quick read here … jump past the first section straight to “Connecting to a Server via SSH in Terminal”. The server referred to there is your RPi, and the command to start the ssh connection will be:

ssh volumio@volumio.local

That should get you yo your RPi’s command line.

(There will also be graphical ssh clients available, if you feel more comfortable in that kind of environment, but you will need to install them … and honestly I don’t think it’s worth the effort for what you are going to do.)

Yes. :slight_smile:

Thanks for your patience! I feel that I’m getting there… then I get this…

[2]+ Stopped sudo nano /etc/systemd/system/systemd-reboot.timer
volumio@volumio:~$ sudo systemctl enable /etc/systemd/system/systemd-reboot.timer
Failed to execute operation: No such file or directory
volumio@volumio:~$ sudo systemctl start /etc/systemd/system/systemd-reboot.timer
Failed to start etc-systemd-system-systemd\x2dreboot.timer.mount: Unit etc-systemd-system-systemd\x2dreboot.timer.mount failed to load: No such file or directory.
volumio@volumio:~$

‘nano’ is a text editor that you are using to make the .timer file. Can you check that you have made the file correctly by typing:

cat /etc/systemd/system/systemd-reboot.timer

and pasting the output here please.

I tried running through the previous instructions again just in case and got the dame result. Here is what I get after inputting your last instruction… guessing something is missing…

volumio@volumio:~$ cat /etc/systemd/system/systemd-reboot.timer
cat: /etc/systemd/system/systemd-reboot.timer: No such file or directory
volumio@volumio:~$