Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 want to run a cronjob once every day on a machine that doesn't run all the time, but runs at least once a day for a couple of hours. The problem with a cronjob is, that I have to give it the exact time, when it is supposed to run, but my machine may not be running at this particular time. I know there is an option to cron that says "do this, when booting" but my machine usually isn't rebooted, but I leave it in standby. Put differently, I want to execute something once a day, but I can't give an exact time. Is there a solution to this?

share|improve this question
up vote 4 down vote accepted

You want something like anacron:

anacron is a computer program that performs periodic command scheduling which is traditionally done by cron, but without assuming that the system is running continuously. Thus, it can be used to control the execution of daily, weekly, and monthly jobs (or anything with a period of n days) on systems that don't run 24 hours a day.

Available as packages in most Linux distributions. There's probably also a port for MS Windows...

share|improve this answer
This is the answer. Perfect – sinni800 Feb 2 '11 at 11:44

You could invoke the job from a startup script in /etc/rc2.d which compares today's date with one saved in a file and then updates that file.

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.