There is two command to schedule automated task, why should I use cron instead of anacron? What is the difference between the two
When we schedule task in cron jobs, we have the possibility to use cron and anacron. But there is a frequently asked question which should be and what are the particularity of the two commands?
Both
cron
and anacron
are daemons that can schedule execution of recurring tasks to a certain point in time defined by the user. The main difference between cron
and anacron
is that the former assumes that the system is running continuously. If your system is off and you have a job scheduled during this time, the job never gets executed.
On the other hand
anacron
is 'anachronistic' and is designed for systems that are not running 24x7. For it to work anacron
uses time-stamped files to find out when the last time its commands were executed. It also maintains a file /etc/anacrontab
just like cron
does. In addition, cron.daily
runs anacron everyhour. Also, anacron
can only run a job once a day, but cron
can run as often as every minute socron
gives minimum granularity in minute whileAnacron
gives it in days- Cron job can be scheduled by any normal user while Anacron can be scheduled only by the super user (the superuser is a special user account used for system administration.
Cron
expects the system to be up and running while theAnacron
doesn’t expect the system to be up and running all the time. In case of Anacron, if a job is scheduled and the system is down that time, it will execute the job as soon as the system is up and running socron
is ideal for servers whileanacron
is ideal for desktops and laptops.cron
should be used when you want a job to be executed at a particular hour and minute whileAnacron
should be used in when the job can be executed irrespective of the hour and minute.
0 Comments
Post a Comment