[Bug 248163] New: rccron restart kills cron if a long job is running
https://bugzilla.novell.com/show_bug.cgi?id=248163 Summary: rccron restart kills cron if a long job is running Product: openSUSE 10.3 Version: Alpha 1 Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: P5 - None Component: Basesystem AssignedTo: mkoenig@novell.com ReportedBy: mmarek@novell.com QAContact: qa@suse.de I start an IRC bot from my crontab using the @reboot rule. The script to start the bot is apparently broken (my fault), because it waits for the bot to exit. But IMO a bug in user's crontab shouldn't break whole cron ;-) Testcase: $ crontab -l | grep -v '^#' @reboot $HOME/cron/bot.sh */1 * * * * $HOME/cron/mark.sh $ cat ~/cron/bot.sh #!/bin/sh while :; do echo "bot[$$]: $SECONDS" sleep 5 done $ cat ~/cron/mark.sh #!/bin/sh echo "mark[$$]: `date -R`" >>$HOME/cron/mark.log The mark script is there only to test whether cron works. # rccron status Checking for Cron: unused # rccron start Starting CRON daemon done # pstree -p .. |-cron(5558)---cron(5559)-+-bot.sh(5560)---sleep(5565) | `-sendmail(5562)---postdrop(5563) .. # grep /usr/sbin/cron /var/log/messages .. Feb 23 10:53:45 discovery /usr/sbin/cron[5558]: (CRON) STARTUP (V5.0) Feb 23 10:53:45 discovery /usr/sbin/cron[5560]: (mmarek) CMD ($HOME/cron/bot.sh) Feb 23 10:54:01 discovery /usr/sbin/cron[5570]: (mmarek) CMD ($HOME/cron/mark.sh) Feb 23 10:55:01 discovery /usr/sbin/cron[5592]: (mmarek) CMD ($HOME/cron/mark.sh) .. So cron (process 5558) works, but if I restart it (eg. when updating cron.rpm) # rccron restart Shutting down CRON daemon done Starting CRON daemon done # pstree -p .. |-cron(5559)-+-bot.sh(5560)---sleep(5669) | `-sendmail(5562)---postdrop(5563) .. So it looks like rccron stop doesn't kill the cron process 5559 (good), but rccron start treats it as if cron was already running and won't start a new one (bad). Perhaps using a pid file would help (just a guess)? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=248163 mkoenig@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=248163 ------- Comment #1 from mkoenig@novell.com 2007-03-09 04:46 MST ------- Yes this can be fixed by this patch --- cron.init~ 2006-03-11 14:59:46.000000000 +0100 +++ cron.init 2007-03-09 12:36:09.000000000 +0100 @@ -23,6 +23,7 @@ CRON_BIN=/usr/sbin/cron test -x $CRON_BIN || exit 5 +PIDFILE=/var/run/cron.pid # Shell functions sourced from /etc/rc.status: # rc_check check and set local and overall rc status @@ -73,7 +74,7 @@ # NOTE: startproc return 0, even if service is # already running to match LSB spec. - startproc $CRON_BIN + startproc -f -p $PIDFILE $CRON_BIN # Remember status and be verbose rc_status -v @@ -83,7 +84,7 @@ ## Stop daemon with killproc(8) and if this fails ## set echo the echo return value. - killproc -TERM $CRON_BIN + killproc -TERM -p $PIDFILE $CRON_BIN # Remember status and be verbose rc_status -v -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=248163 mkoenig@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED ------- Comment #2 from mkoenig@novell.com 2007-03-09 06:46 MST ------- submitted to stable -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=248163 mmarek@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |VERIFIED ------- Comment #3 from mmarek@novell.com 2007-03-14 07:56 MST ------- Works perfectly, thanks! -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
participants (1)
-
bugzilla_noreply@novell.com