How to start, stop, and restart a cron job

Start a cron job

A cron job is started the moment it is added to the crontab. Note that the task may fail to run if the cron daemon isn’t started. To start the cron service on your Linux machine, run one of the following commands, depending on your Linux distro.

sudo /etc/init.d/cron start

Stop a cron job

You can stop a single cron job by removing its line from the crontab file. To do that, run the crontab -e command and then delete the line for the specific task. Alternatively, you can stop the cron job by commenting it out in the crontab file.

To stop all cron jobs at once and maybe resume them later, you can stop the cron daemon using the following commands:

sudo /etc/init.d/cron stop

Restart a cron job

To restart the cron daemon, run the following commands:

sudo /etc/init.d/cron restart

Leave a Reply

Your email address will not be published.