Is there any command that can switch ON/OFF cron job in Ubuntu?

As far I know to open crontab -e and comment out each cron job. Is there any single command to stop all cron job and restart later?

Currently I have multiple cron jobs running on different time to send email alerts, monitoring results, automatic DB update(hourly), weekly status etc

But then during maintenance time, I need to stop all these cron jobs and restart once maintenance is over. Now disabling one by one with # symbol.

Is there any solution?

1 Answer

For the single cron job you can comment by editing with crontab -e.

If you have to stop all the cron jobs:

sudo service crond stop sudo service crond status sudo service crond restart 

or

/etc/init.d/cron start /etc/init.d/cron status /etc/init.d/cron restart 

or

sudo systemctl stop cron sudo systemctl status cron sudo systemctl restart cron 
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy