ubuntucronreboot

Why 'reboot' operation does not work with crontab?


I am using ubuntu 18.04.

I want to reboot my server every day.

Here is my crontab file for root, which is I can see with 'sudo crontab -e' operation

0 0 * * * rm /var/log/*log.*
0 0 * * * rm /var/log/rinetd.log
1 0 * * * reboot now

I confirmed that the rest of the commands work well, but only the 'reboot' command doesn't work and I do not know the reason. I checked that 'reboot now' operation works well in the bash shell.

obiwan@myserver ~ sudo reboot now
Connection to 10.10.10.122 closed by remote host.
Connection to 10.10.10.122 closed.

When I searched for it, I only found questions about the '@reboot' option in the crontab do not work, so I'm writing this question.

Always, thank you a lot.


Solution

  • So I started having this issue as well, recently too.

    I've been doing a little digging, and so far what I have found is the following:

    So this is a temporary fix that can get your system working for now, but I'm going to keep digging.

    EDIT: There's something more going on here, it doesn't seem to just be a su related problem. I passed my password plaintext to 'sudo systemctl reboot' and it didn't fire.