What is anacron service?
Similar to the cron service, the anacron service runs applications or scripts at specific times and dates. Anacron ensures that each job is run at the scheduled interval; there is no specific time guaranteed for these jobs to be run. Each time the job is run, the timestamp file /var/spool/anacron/cron.
How do you set an anacron job?
Schedule jobs with anacron
- PERIOD – specifies how frequently (in days) the command will be run.
- DELAY – specifies the delay perion (in minutes) between the time the anacron program starts and the command will be run.
- JOB-IDENTIFIER – the name for the job’s timestamp file.
- COMMAND – the command that will be run.
How does anacron know when to run a job?
After the command exits, Anacron records the date (excludes the hour) in a special timestamp file for that job, so it knows when to execute that job again. When there are no more jobs to be run, Anacron exits. Anacron only considers jobs whose identifier, as specified in anacrontab (5), matches any of the job command-line arguments.
How does the anacron function work in Cron?
In cron if a machine is not running on time of a scheduled job then it will skip it, but anacron is a bit different as it first checks for timestamp of the job then decides whether to run it or not and if its timestamp is >=n (n is defined number of days) then runs it after a specified time delay.
When to stop anacron in the time zone?
After receiving a SIGUSR1 signal, Anacron waits for any running jobs to finish and then exits. This can be used to stop Anacron cleanly. Make sure your time-zone is set correctly before Anacron is started since the time-zone affects the date.
What’s the difference between N and D in anacron?
Anacron will not start a new job before the previous one finished. n : Run jobs now.Ignore any delay. d : Don’t fork to the background. In this mode, Anacron will output informational messages to standard error, as well as to syslog.