2

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?

icyrock.com
  • 869
  • 1
  • 12
  • 20

1 Answers1

3

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.

roadmr
  • 33,892
  • 9
  • 80
  • 93
  • 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 01 '12 at 05:15