Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a script that I want to run nightly on my lab's RHEL 5 and 6 workstations, so I'm deploying the script to each system's /etc/cron.daily/ directory and making it executable there. But some workstations may not be powered on at the time when cron.daily runs, so I believe anacron might be more appropriate for this purpose.

How would I go about converting this simple cron set-up to use anacron instead of cron?

It seems that /etc/anacrontab already runs the scripts in /etc/cron.daily as well:

# /etc/anacrontab: configuration file for anacron

# See anacron(8) and anacrontab(5) for details.

# the maximal random delay added to the base delay of the jobs
# the jobs will be started during the following hours only

#period in days   delay in minutes   job-identifier   command
1   5   cron.daily      nice run-parts /etc/cron.daily
7   25  cron.weekly     nice run-parts /etc/cron.weekly
@monthly 45 cron.monthly        nice run-parts /etc/cron.monthly

Are there any steps needed to make sure the workstations will execute the script in a more or less reliable fashion?

share|improve this question
up vote 1 down vote accepted

If your workstations are not reliably powered on then anacron is the tool for the job as the manpage says does not assume that the machine is running continuously. Hence, it can be used on machines that aren’t running 24 hours a day, to control regular jobs as daily, weekly, and monthly jobs.

Further down it says how

For each job, Anacron checks whether this job has been executed in the last n days, where n is the period specified for that job. If not, Anacron runs the job’s shell command, after waiting for the number of minutes specified as the delay parameter.

SO it would appear that all you have to do is add suitable entries to your anacrontab file.

share|improve this answer
My reading of the default anacrontab file above is that it runs all scipts in /etc/cron.daily (nice run-parts /etc/cron.daily) . In this case just placing my shell script in the workstation's /etc/cron.daily directory and making it executable should suffice then? – Gestellen Nov 7 '13 at 17:50
Probably yes but that's easily tested. – Iain Nov 7 '13 at 21:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.