1824725 Members
3736 Online
109674 Solutions
New Discussion юеВ

stop cron temporarily.

 
joe_91
Super Advisor

stop cron temporarily.

Hi:

We use filesets(SD-UX) for Application installations. we have a requirement to stop an application process (bmq) when we install that particular applicaion filesets. However there is cron job which runs every 5 minutes which would see if that particular Appln. process is running and if not it would restart that process. Now we have do some work on the machine periodically for which we need that appln. process to be stopped for sometime. How would we handle the cron job(which would restart the process after 5 minutes) for this. Is there a way that we can stop that particular cron job temporarily? Please advise.

Thanks
Joe.
3 REPLIES 3
Michael Tully
Honored Contributor

Re: stop cron temporarily.

as root:

# crontab -l >/tmp/wrk
# vi /tmp/wrk

comment out the line in question that runs the script with a '#' without the quotes
Save the file
:wq!

Submit the crontab file
# crontab /tmp/wrk

When your finished, do the same thing again, this time removing the comment marker.
Anyone for a Mutiny ?
avsrini
Trusted Contributor

Re: stop cron temporarily.

Hi Joe,
You can edit the crontab entry by crontab -e.
Put a # before the line starting the apps to comment it. Once you installation is over, your remove this comment.

Srini.
Be on top.
A. Clay Stephenson
Acclaimed Contributor

Re: stop cron temporarily.

My standard way of doing this is to let the cronjobs go ahead and run but each reads a config file (very similar to the /etc/rc.config.d standard for /sbin/rcN.d scripts. Typically, if a configuration value is set to 0 the cron script simply exits with a zero status.

If all you need is a quick and dirty, you can do a crontab -l > myfile, edit myfile and remove the entry, and then crontab < myfile to reconfigure cron. An even simpler method is to simply put an 'exit 0' statement before any other commands in your cron script.
If it ain't broke, I can fix that.