Turn off volumio every day at the same time

Volumio Version: V2.917
Hardware: Raspberry Pi3b
DAC: HiFi Berry plus

I wanted to set an automatic shutdown every day at the same time. I tried using this tutorial ([GUIDE] How to set up Volumio to reboot nightly) and using the command

05 17 * * * root shutdown

but the raspberry won’t shut down.

Where am I wrong?

your crontab command has to make sense … if you type it at the CLI what happens?

volumio@volumiokitchen:~$ root shutdown
-bash: root: command not found

So, you need to write a script to do the shutdown for you, and include it in the crontab. Alternatively, you can use the Volumio node scripts, or the systemd timer idea further down in the post to which you linked.

Note that the node scripts will not work for Volumio 3.

1 Like

I don’t know how to write the script.
Also, once created, do I have to copy it into the volumio SD and launch it via crontab?
I saw a different solution: add to rc.local the command shutdown -h 23:00 (for example) so that at each start it switches off by itself at the set time. It work?
The command launched from CLI works… it could be a solution?

yes

You should also be able to use rc.local as an alternative with ‘shutdown’ (since ‘shutdown’ has an inbuilt scheduler)

You need to run an appropriate command at the particular time that you want the shutdown to occur … this is effectively what ‘cron’ does. So you set up your crontab in your first post, and have either a script to run your shutdown procedure, or use the command directly eg. ‘sudo shutdown now’. I suggested a script because that is my personal preference (it is easy to tweak/adjust the script without needing to edit the crontab).

Thank you
In the end I managed using crontab: since I have 5 PI with volumes andI am better off using crontab scheduling like this:

35 15 * * * sudo shutdown now (for example)

Thanks again