Part of Linux
Sometimes, you want a job to be run, but you don't want to / can't assume that the host will be up and ready.
If that is the case, cron will not be an ideal fit, since it assume the last job was run as expected.
For this cases, we can use anacron. Do note that anacron only uses days, and not hours in it's calculations
Using the following example:
7 15 test.daily /bin/sh /home/username/script.sh
Clarification
Value | Explanation |
---|---|
7 | Number of days between each job execution |
15 | Delay in minutes, to run the job if the job is due |
test.daily | Unique name identifier for the job |
/bin/sh | Bash to use |
/home/username/script.sh | Script Location |
To install anacron (in Debian):
sudo apt install anacron -y
To edit anacron information:
sudo nano /etc/anacron