View previous topic :: View next topic |
Author |
Message |
magowiz Veteran
Joined: 17 Feb 2005 Posts: 1029 Location: Italy/Milan/Bresso
|
Posted: Sat May 16, 2009 7:42 am Post subject: vixie-cron hangs and I cannot restart it until I kill it |
|
|
There's a strange thing happening with my vixie-cron , sometimes it hangs, and the only way I have to restart it is to kill -s 9 cron and then /etc/init.d/vixie-cron start . Perhaps it is a problem with one of mine scripts in cron :
Code: | #!/bin/sh
source /etc/make.globals
source /etc/make.conf
source /etc/distcleaner.conf
ls /usr/portage/distfiles/*-clean-global-lock
ret=$?
while [ $ret -eq 0 ]; do
sleep 30
ls /usr/portage/distfiles/*-clean-global-lock
ret=$?
done
if [ `mount | grep ${DISTDIR} | wc -l` -eq 1 ]; then
umount ${DISTDIR}
fi
/etc/init.d/anacron stop
/etc/init.d/vixie-cron stop
/etc/init.d/nfsmount stop
/etc/init.d/nfs-distfiles-merge zap
eclean-dist -d
/etc/init.d/nfs-distfiles-merge start
/etc/init.d/nfsmount start
/etc/init.d/vixie-cron start
/etc/init.d/anacron start |
So my question is : is it possible to stop vixie-cron using a cron script? If it is not, is there a command that suspend all cron operations and then restart it ? Is there a command to force the execution of cron.daily to test it ? |
|
Back to top |
|
|
Malvineous Apprentice
Joined: 20 Oct 2006 Posts: 281 Location: Brisbane, Australia
|
Posted: Thu May 21, 2009 5:54 am Post subject: |
|
|
Presumably if you start your script with & after it it will run in the background, allowing vixie-cron to continue. My guess is that when you try to stop it, it waits until all running cronjobs have finished before exiting, and your shutdown script must wait until vixie-cron exits before returning too - hence a deadlock.
If your script runs in the background then the cronjob should complete and vixie-cron will close down when asked. |
|
Back to top |
|
|
magowiz Veteran
Joined: 17 Feb 2005 Posts: 1029 Location: Italy/Milan/Bresso
|
Posted: Thu May 21, 2009 7:20 am Post subject: |
|
|
I solved using another strategy, instead of stopping the whole vixie-cron, with that script I create a lock file at the beginning and I remove it at the end , I have another script that runs every 5 min but it must not be executed while the first one is running, so I simply check at the beginning of the script if the lock file exists, and if exists it immediately exits. |
|
Back to top |
|
|
|