For whatever my reasons, I want to restart my Ubuntu server every 6 hours via cronjob. I added a cronjob in crontab -e being the following:
* */6 * * * root /sbin/shutdown -r now
however I just checked my uptime and it's 10+ hours.
Any ideas?
For whatever my reasons, I want to restart my Ubuntu server every 6 hours via cronjob. I added a cronjob in crontab -e being the following:
* */6 * * * root /sbin/shutdown -r now
however I just checked my uptime and it's 10+ hours.
Any ideas?
Full reboots are not recommended like this. I think you are already aware of this so here's an answer to your question.
I suspect that your problem is that the contrab -e command is designed for a user to add their own cron scripts. It's not generally used for adding system (root) cron entries.
I believe you would be better to manually add a file in /etc/crontab.d/ or even add an entry in /etc/crontab.
/etc/crontab might get overwritten on system upgrades, so a files in /etc/crontab.d is a better choice.
– Tero Kilkanen
Jun 23 '17 at 16:34
crontab -e? – Gerald Schneider Jun 23 '17 at 13:15root. If you are editing cronjob with crontab -e as root , you don't have to specify it – P0pR0cK5 Jun 23 '17 at 13:18