Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

crontab deamon 4

Status
Not open for further replies.

AIXFinder

IS-IT--Management
Jan 4, 2007
97
US
Is it possible to stop and start crontab daemon?
If yes, how do you do that?

thx much
 
You could kill the process identified using a ps -ef | grep cron, then restart it using nohup /usr/sbin/cron &. though /etc/inittab specifies that the process should respawn if it dies - perhaps the nohup wouldn't be necessary.

 
cron is started as a respawning daemon from init. As such I don't think you can change it's status without restarting to OS.

A quick and dirty answer is
Code:
crontab -l > /tmp/crontab.saved #backup the crontab
touch /tmp/empty.file #create an empty file
crontab -l /tmp/empty.file #delete all entries by replacing them with the 'contents' of empty.file
#cron is now running but has no entries so it won't do anything
crontab  /tmp/crontab.saved #reload the saved cronjobs
Ok, so that's not what you asked, but the effect is the same.

Ceci n'est pas une signature
Columb Healy
 
Use chitab to change respawn to off

chitab "cron:23456789:eek:ff:/usr/sbin/cron"

You may have to then

ps -ef|grep /usr/sbin/cron

and kill -9

and to turn it back on, change

the off to respawn



Mike

"Whenever I dwell for any length of time on my own shortcomings, they gradually begin to seem mild, harmless, rather engaging little things, not at all like the staring defects in other people's characters."
 
If you want to stop cron and keep it from restarting automatically, you can change its start-method from "respawn" to "off" using chitab (see man page).

to turn cron off:
chitab "cron:2:eek:ff:/usr/sbin/cron"

to turn cron back on:
chitab "cron:2:respawn:/usr/sbin/cron"


HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top