Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
vixie-cron hangs and I cannot restart it until I kill it
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
magowiz
Veteran
Veteran


Joined: 17 Feb 2005
Posts: 1029
Location: Italy/Milan/Bresso

PostPosted: Sat May 16, 2009 7:42 am    Post subject: vixie-cron hangs and I cannot restart it until I kill it Reply with quote

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
View user's profile Send private message
Malvineous
Apprentice
Apprentice


Joined: 20 Oct 2006
Posts: 281
Location: Brisbane, Australia

PostPosted: Thu May 21, 2009 5:54 am    Post subject: Reply with quote

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
View user's profile Send private message
magowiz
Veteran
Veteran


Joined: 17 Feb 2005
Posts: 1029
Location: Italy/Milan/Bresso

PostPosted: Thu May 21, 2009 7:20 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum