Hello,
I have scheduled the execution of a file ( delete_oldv02
) every hour with crontab
and it works perfectly. See below the instruction written.
0 */1 * * * /home/delete_oldv02 >>/home/delete_oldv02.log
My first question is if I can add one more line to crontab
.
I also would like to make the system reboot every Saturday afternoon at 1.30 PM.
Can then anyone please check if below written does make make the system reboot every Saturday afternoon at 1.30 PM?
30 13 * * Sat reboot
Thanks a lot, Daniele
What operating system are you using?
Which user's crontab
file contains these commands?
Is the reboot
command on your system's default command search path?
If you aren't running a Windows system, why do you want to reboot it every week? Most people run their BSD, Linux, and UNIX systems without rebooting unless it is time to install updates to the operating system, to install new hardware, or to replace broken hardware.
Thanks for your attention.
I am using Openmediavault for Raspberry pi3 which I have configured as a ftp backup server of my network video recordings.
The root commands contains these commands and I did not change the default search path.
I would like to regularly reboot it just to be safe.
Thanks for checking, Daniele
You didn't answer most of my questions. So I have absolutely no way to guess at whether or not the reboot command will work or not.
If you're in the US Pacific time zone (like I am) and you install that line in root's crontab file in the next seven minutes, you'll quickly find out whether or not it works at 1:30 this afternoon. The system's default PATH variable setting frequently does not include the directory in which the reboot
utility is located; so I would suggest using an absolute pathname instead of just reboot
. Sat
might work to tell cron
to run a job on a Saturday, but day names are not required to be recognized by cron
by the standards. (The standards say that 6
in that field indicates Saturday; some implementations of cron
accept strings in addition to numbers.)
On most systems, only root or a user running with elevated privileges can run the reboot
utility successfully. Each user on your system can have his or her own crontab
file. If you use that crontab
line in a normal user's crontab
file, it probably won't work. And you haven't told us whose crontab
file you are using nor what user you are logged in as when you invoke crontab
.
When I invoke crontab, I am logged as root.
I have not understood if crontab can include more than one instructions and if it remains active after a reboot.
Thanks
Yes, you can use crontab
to create many cron
jobs.
If the system is down, any cron
jobs that would have been scheduled to run while the system is down will not be run. When the system reboots, cron
will restart and any jobs that should be scheduled to run after the system reboots will be run until the system goes down again or cron
is disabled.