Operating System - HP-UX
1820117 Members
2966 Online
109619 Solutions
New Discussion юеВ

Deactivating single cron job via command line

 
frederick hannah
Super Advisor

Deactivating single cron job via command line

Is there a command where I can deactivate or activate an individual cron job without impacting cron itself?
4 REPLIES 4
Stuart Abramson
Trusted Contributor

Re: Deactivating single cron job via command line

Not to my knowledge.

I ususally do something like this:

crontab > file.orig
cp file.orig file.new
vi file.new
crontab < file.new

You could do something like:

crontab -l | sed 's/^LINE/#LINE/' > file.new
crontab < file.new

where LINE is the line you want to deactivate; but it's a risky thing.

I guess you want to turn off a cronjob automatically by script...
G. Vrijhoeven
Honored Contributor

Re: Deactivating single cron job via command line

Hi Frederick,

You could temparary change the script cron calls by a dummy one that does an exit 0.

HTH,

Gideon
frederick hannah
Super Advisor

Re: Deactivating single cron job via command line

Thanks for the response. I will try the "exit 0" solution.
frederick hannah
Super Advisor

Re: Deactivating single cron job via command line

I think I have found the solution in scripting