Revision: 7369
          http://sourceforge.net/p/ipcop/svn/7369
Author:   owes
Date:     2014-03-24 18:59:20 +0000 (Mon, 24 Mar 2014)
Log Message:
-----------
fcron cannot be killed with SIGTERM when fcron jobs are still running.
So try something different: SIGTERM fcron (not the jobs), wait some time, 
SIGKILL fcron if still running.

This is probably a good idea to do for every upgrade. So we do not disturb any 
fcron jobs with unpacking the update package.

Modified Paths:
--------------
    ipcop/trunk/updates/2.1.3/setup

Modified: ipcop/trunk/updates/2.1.3/setup
===================================================================
--- ipcop/trunk/updates/2.1.3/setup     2014-03-24 11:18:47 UTC (rev 7368)
+++ ipcop/trunk/updates/2.1.3/setup     2014-03-24 18:59:20 UTC (rev 7369)
@@ -27,6 +27,21 @@
     exit 1
 fi
 
+
+FCRONPID=`cat /var/run/fcron.pid`
+/bin/kill $FCRONPID
+COUNT=15
+
+while [ -e /var/run/fcron.pid -a ${COUNT} -ge 0 ]
+do
+    sleep 1
+    COUNT=$(( ${COUNT} - 1 ))
+done
+
+if [ -e /var/run/fcron.pid ]; then
+    /bin/kill -KILL $FCRONPID
+fi
+
 #####
 #
 # Add version specific handling *before* unpacking the patch here.
@@ -34,11 +49,6 @@
 #
 #####
 
-# Patch fcrontab for new fcron
-/bin/sed -i -e 's|^!mailto.*|#!mailto()|g' /var/spool/cron/root.orig
-# Patch frontab for renamed makegraphs
-/bin/sed -i -e 's|makegraphs |makegraphs\.pl |g' /var/spool/cron/root.orig
-/usr/bin/fcrontab -z
 
 #####
 #
@@ -162,15 +172,11 @@
 # Use new sshd
 /usr/local/bin/restartssh
 
-# Restart fcrond to activate new version
-/usr/bin/killall fcron
-# We need a small pause to give fcron time to stop
-sleep 1
-if [ -e /etc/FLASH ]; then
-    /usr/sbin/fcron -s 86400
-else
-    /usr/sbin/fcron
-fi
+# Patch fcrontab for new fcron
+/bin/sed -i -e 's|^!mailto.*|#!mailto()|g' /var/spool/cron/root.orig
+# Patch frontab for renamed makegraphs
+/bin/sed -i -e 's|makegraphs |makegraphs\.pl |g' /var/spool/cron/root.orig
+/usr/bin/fcrontab -z
 
 #####
 #
@@ -178,6 +184,13 @@
 #
 #####
 
+# Restart fcron
+if [ -e /etc/FLASH ]; then
+    /usr/sbin/fcron -s 86400
+else
+    /usr/sbin/fcron
+fi
+
 # Patch general-functions.pl
 /bin/sed -i -e "s+^\(\$General::version\s*=\s*\).*+\1'$UPGRADEVERSION';+" 
/usr/lib/ipcop/general-functions.pl
 # Patch /etc/issue

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Ipcop-svn mailing list
Ipcop-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-svn

Reply via email to