How can I prevent cronjobs from automatically starting after my server has rebooted?

Every time I reboot my server the cronjobs start up again, which I'd like to prevent.

These servers are running Ubuntu 12.04 x32

  • Why have cron jobs at all if you don't want them to run? (I probably don't understand your question.) – Mat Dec 24 '13 at 20:45
  • I still use them , but do not want them to start up until I say so (as is the case with server reboot). – d-_-b Dec 24 '13 at 20:49
  • 1
    Disable the cron daemon's startup script then? – Mat Dec 24 '13 at 20:50
  • Yep, that's why I have this question here! ... how is that done? – d-_-b Dec 24 '13 at 20:52

If memory serves, Ubuntu uses anacron, which by design runs cron jobs that were missed due to downtime, presumably to make cron jobs more reliable on laptops and other systems that are expected to be turned off more often than servers typically are.

If you don't wish this behavior, switch to another cron daemon that is not designed to run missed scheduled tasks.

  • 1
    Maybe you could explain to him how to disable this service as part of your answer? Try and be specific and show examples. – slm Dec 24 '13 at 21:48
  • I only known anacron from CentOS. Can`t you just configure anacron in Ubuntu so it behaves more like the classical cron? – Nils Dec 29 '13 at 22:04

I'm using a very hacky method:

Comment out all cronjob lines:

echo "$(crontab -l)" | sed -e "s/^/#/g" | crontab

Uncomment out all cronjob lines:

echo "$(crontab -l)" | sed -e "s/#//g" | crontab

This way, if I reboot, it's commented out for when the cronjobs start up again.


I hope this answer from Ask Ubuntu is still valid.

On CentOS cron has been removed in favour of anacron - but it works a little bit different there. On Ubuntu:

It burns down to - imho - uninstall anacron. This will remove the anacron binary putting cron into "normal" mode without anacron kicking in.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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