Table of Contents

Using anacron instead of cron

Part of Linux

Why anacron?

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

anacron Options

Using the following example:

7  15  test.daily  /bin/sh  /home/username/script.sh

Clarification

ValueExplanation
7Number of days between each job execution
15Delay in minutes, to run the job if the job is due
test.dailyUnique name identifier for the job
/bin/shBash to use
/home/username/script.shScript Location


Using anacron

To install anacron (in Debian):

sudo apt install anacron -y

To edit anacron information:

sudo nano /etc/anacron