Script disen_cronjobs.sh will help to disable and enable all cronjobs during maintenance. Script can be executed with below two options

Disable cronjobs before starting maintenance
$ sh disen_cronjobs.sh disable

Enable cronjobs after maintenance
$ sh disen_cronjobs.sh enable

Note: Script should be executed with disable option first in order to make a backup of existing crontab entries

disen_cronjobs.sh

Below is the sample execution and output of script

$ crontab -l
*/5 * * * * sh /home/oracle/scripts/dbcheck.sh
*/5 * * * * sh /home/oracle/scripts/listenercheck.sh

$ sh disen_cronjobs.sh

Script Usage
sh disen_cronjobs.sh (disable|enable)

$ sh disen_cronjobs.sh enable
Enabling Cronjobs from backup @02/Oct/2020 09:22:41 GMT
No /home/oracle/scripts/cronjob.crj.bkp File Exist
Run script with disable option first

$ sh disen_cronjobs.sh disable
Disabling Cronjobs @02/Oct/2020 09:23:41 GMT
Making current cronjob backup and disabling all entries
*/5 * * * * sh /home/oracle/scripts/dbcheck.sh
*/5 * * * * sh /home/oracle/scripts/listenercheck.sh

New CRON Entry
==============
#*/5 * * * * sh /home/oracle/scripts/dbcheck.sh
#*/5 * * * * sh /home/oracle/scripts/listenercheck.sh

$ sh disen_cronjobs.sh enable
Enabling Cronjobs from backup @02/Oct/2020 09:24:02 GMT
*/5 * * * * sh /home/oracle/scripts/dbcheck.sh
*/5 * * * * sh /home/oracle/scripts/listenercheck.sh
Recent Posts

Start typing and press Enter to search