Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop cron jobs created by "whenever" gem

I'm using the "whenever" gem and got it working by doing:

whenever --set environment=production --update-crontab theCronJob

The interval I'm using is 2 minutes since I'm still trying to figure it out. However, now I get a You have mail message in my terminal window every 2 minutes. I guess the cron runs and lets me know about it. How do I stop my cron from running? These messages are starting to pile up.

Thank you

like image 553
AdamT Avatar asked Dec 15 '11 20:12

AdamT


People also ask

How do I stop my cron job from automatically running?

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.

Do Cronjobs run automatically?

The cron reads the crontab (cron tables) for running predefined scripts. By using a specific syntax, you can configure a cron job to schedule scripts or other commands to run automatically.

How do I remove a cron schedule?

By default, crontab file protections are set up so that you cannot inadvertently delete a crontab file by using the rm command. Instead, use the crontab -r command to remove crontab files. By default, the crontab -r command removes your own crontab file.

What is the use of * * * * * In cron?

It is a wildcard for every part of the cron schedule expression. So * * * * * means every minute of every hour of every day of every month and every day of the week .


2 Answers

To delete the auto-generated cronjobs from your crontab, run whenever against your defintion file with the -c flag:

$ whenever -c theCronJob

Alternatively, open your crontab...

$ crontab -e

... and then manually delete the undesired entries.

like image 135
jbrowning Avatar answered Oct 02 '22 08:10

jbrowning


following will delete the scheduled crontab:

crontab -r
like image 32
deepak raghuwanshi Avatar answered Oct 02 '22 09:10

deepak raghuwanshi