Command to ON/OFF cron job
Olivia Zamora
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 restartor
/etc/init.d/cron start
/etc/init.d/cron status
/etc/init.d/cron restartor
sudo systemctl stop cron
sudo systemctl status cron
sudo systemctl restart cron 1