I´ve create this file : /home/user/rest.sh (rwxr-xr-x).
------------------------------
#!/bin/bash
#rest.sh
shutdown -r now
-----------------------------
Edited the crontab file with crontab -e command.
inserted this line :
30 14 * * * /bin/sh /home/user/rest.sh
But the computer didn´t restart. What I´m doing wrong /
I´m using Debian Wheezy
LinuxOperating Systems
Last Comment
Jose Bredariol
8/22/2022 - Mon
David Favor
Keep in mind, this will only work in the root CRON file, never a non-super user account.
Only root (and other admin accounts) have privilege to run shutdown.
noci
Unprivileged user cannot do this,
either you need to use sudo (as an admin account) to run reboot /shutdown -r , or install this entry under the root user.
Also be aware that the regular path is NOT available in active cron jobs.
It is a good practice to qualify the command with full pathname.
shutdown is also in /sbin which might not be in the default path...
(You should receive a mail upon failure.)
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
Only root (and other admin accounts) have privilege to run shutdown.