Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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'd like to use anacron to run a job annually. I see only daily, weekly, and monthly configuration for anacron. Is there a way to run a job once per year?

share|improve this question
up vote 3 down vote accepted

Ofcourse and it is already there with the possible selections you have: pick 1 specific day and 1 specific month and it will run once per year. Day 1 of month 1 would be on the 1st of January.

Anacron has 2 ways of defining lines. The 2nd one is like this:

 @period_name delay job-identify command

The period_name can be set to daily, weekly, monthly, yearly or annualy. This will ensure jobs are run once a week, month or year no matter the number of days in this period.


@yearly 0 job1 /usr/bin/execute_me

The 0 means no delay. job1 is an identifier and the command to execute.

share|improve this answer
How would @period_name work with anacron? I thought it was used in crontab, which doesn't guarantee execution if the machine is off. – Jeremy Stein Nov 25 '12 at 18:23
Ah, so could I add a line to anacrontab like this: @yearly 20 cron.yearly nice run-parts --report /etc/cron.yearly and then add my scripts to /etc/cron.yearly? – Jeremy Stein Nov 25 '12 at 18:28
Do not know for sure but that last part (nice run-parts --report /etc/cron.yearly) probably needs to be 1 command (not that that is a problem since you can toss that in a script and execute the script). – Rinzwind Nov 25 '12 at 18:33

I think this would work unless my computer was off for all of January:

File in /etc/cron.monthly:

month=`date +%m`
if [ $month -eq 1 ]
then do_yearly_task
share|improve this answer

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.