Robustly disabling specific cron.{hourly,daily,weekly} script

Solution 1:

You should be able to chmod -x scriptname to disable a script but leave the file in place.

Solution 2:

run-parts does not execute jobs which have a dot in their name, so

mv /etc/cron.d/job /etc/cron.d/job.disabled

will do the trick.


Solution 3:

Usually cron.daily is invoked via /etc/crontab through a line like e.g.

run-parts --report /etc/cron.daily

man run-parts gives you the options.

run-parts --test /etc/cron.daily shows which jobs are executed without running them.

I prefer to make a subdir 'Disabled' and move my jobs there.

In any case if you update a package it is likely that the job gets into place again or that removed 'x' bits get restored