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 need to create a package, which should add itself to list of cron jobs, and remove it from that list on deinstallation.

How can I do it without possibility of screwing the crontab file? Maybe there are some utils?

share|improve this question
up vote 5 down vote accepted

Instead of adding your lines to a crontab, you should just place a file inside /etc/cron.d/. See

The second type of crontab is to be found in /etc/cron.d. Within the directory are small named crontabs. The directory is often used by packages, and the small crontabs allows a user to be associated with the commands in them.

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.