Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I see that Ubuntu uses /etc/cron.{daily,weekly,monthly} for cron jobs. I also see that some things, like updatedb from mlocate, put their jobs there:

$ dpkg -L mlocate|grep y/m
/etc/cron.daily/mlocate

Somtetimes, I would like to disable some of these jobs (mlocate in this case). I can obviously sudo mv /etc/cron.daily/mlocate ~/cron.daily-dont-run and be over with it. However, two questions:

  • Is this how this gets managed? Is there something like service to manage SysV init scripts or overrides such as described in Upstart intro, 10.41.1 Override Files? I would like to tell it "OK, I don't want you to start", but without touching what is installed (see next item for one of the reasons)
  • If I delete and then reinstall mlocate, I'll again get the cron.daily entry. Also, I guess (is this true?) upgrades will probably not go smoothly (e.g. it will make a cron.daily entry or maybe possibly break the package if there's something in the cron entry that it depends on).

If you do, how do you manage / deal with the things such as the above?

share|improve this question
add comment

1 Answer

One way to do it is to chmod -x /usr/bin/updatedb.mlocate . The cron script checks for the +x bit and will exit if it's not executable. Should be less intrusive than messing with the cron files, with the caveat that running updatedb.mlocate manually will be more complicated.

share|improve this answer
1  
Copying the file elsewhere, then blanking the file should work. I don't know if this is true for cron jobs, but for config files, apt will present a diff of the two when updating. This should allow you to keep your blanked version (or not) without messing with the update process. –  Huckle Mar 1 '12 at 5:15
add comment

Your Answer

 
discard

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.