Cron setup guide

Hi, I am trying to setup my volumio to shut down on specific time.
I found several guides to install cron to do the job. i have installed cron as provided. But i can not get it worked. I have checked the basic set up concerning location and time and both are correct.
I have edited /etc/crontab with nano and added before the last # the following for example 23 10 * * * root halt.
Then i used sudo crontab -e to edit (different file) with the same syntax.
Non worked. What do i do wrong? How to set cron up correctly?
thanks

have you tried to use the sleep function?

No, i will give it a try, but i am still interested in cron setup.
thank you

i succeed with sudo crontab-e and adding to the end of the file without # the command line with sudo halt. However i have now another issue. After shutting it down with the halt command, upon restarting the network connection fails. I need to start several times until suddenly it connects.

What is the correct shutdown command to use in command line?

Finally i have got it working:

  • sudo shutdown -h

thanks

thank you so much

I run into the following where i need further help.
Running scheduled shutdown process works fine with crontab. The system shuts itself down as expected. However i have a problem with restarting it in a later time.
If i restart the system it fails to connect to the network first i.e. the wired connection does not show up in router GUI. Then i simple disconnect the unit (not having other accessibility to shut it down properly), reconnect it, wait to boot, then it “finds” the network, shows up in router GUI, but volumio itself at xxx.local is not accessible againt. Same “hard reset”, let it boot up then everything works fine.
Can it be that after using the sudo shutdown -h now command makes a shut down so fast that disconnection from network is not possible and that the system somehow enters a safe mode by the next boot? It seems to me that if i use the shutdown button in volumio own GUI than process differs from the shutdown process issued from terminal. I have read it somewhere the in order to shutdown the system correctly it needs to stop playing. Obviously the crontab orders to shutdown the system while it plays something.
thanks

now i have changed the crontab entry to:
40 11 * * * sudo volumio stop; sudo shutdown -h

The system shutted down correctly but upon restarting still same problem

shutdown -p
gives the same result

tried:
poweroff
systemctl poweroff
/usr/bin/sudo systemctl poweroff

All these shuts down the system, but why can not start up correctly for the first time???

i have used the Power Off button on GUI and interestingly it causes the same issue. I have an other running Pi Zero with volumio that uses a different phat (Pimoroni audio) there everything works fine. The one that has a problem uses a Justboom Amp Zero phat. May it be the reason???

There is another difference as well. The working one uses a Waveshare phat for the wired connection vs the problematic one used a Ethernet micro usb adapter in the Zero mircoUSB.

instead of volumio.local use the ip addres of the device if volumio.local fails…

tried, but does not work. Putty fails too. Even cmd ssh root@x.x.x.x fails as well

i did some more testing. Changed network connection to wireless and everything works fine, upon restarting the system function as expected. It must have something with the wire connection i.e. with adapter. Maybe it does not shut down correctly. Any idea?

i ve got it. Micro USB OTG Ethernet adapter is without exteranl power supply. And it is said in some Pi forums that i may not startup correctly if it is not powered externally. So the solution was/is the upon restart i need to unplug and replug the usb adapter. Thanks for considering my request
cheers

name: volumio / pass: volumio with sudo command will do all you need.

yes it indeed does, if otg adapter is powered. But that is what fails. By unpluging/repluging it works