Просмотр исходного кода

Add SIGTERM support and have the init script wait for corosync to actually terminate. Bud rh#525552

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2520 fd59a12c-fef9-0310-b244-a6a79926bd2f
Andrew Beekhof 16 лет назад
Родитель
Сommit
4fba207d42
2 измененных файлов с 17 добавлено и 4 удалено
  1. 1 0
      exec/main.c
  2. 16 4
      init/redhat

+ 1 - 0
exec/main.c

@@ -1224,6 +1224,7 @@ int main (int argc, char **argv)
 	(void)signal (SIGSEGV, sigsegv_handler);
 	(void)signal (SIGABRT, sigabrt_handler);
 	(void)signal (SIGQUIT, sigquit_handler);
+	(void)signal (SIGTERM, sigquit_handler);
 #if MSG_NOSIGNAL != 0
 	(void)signal (SIGPIPE, SIG_IGN);
 #endif

+ 16 - 4
init/redhat

@@ -27,11 +27,23 @@ start() {
 
 stop() {
     echo -n $"Stopping Corosync Cluster Engine ($prog): "
-    killproc $prog
-    retval=$?
-    [ "$retval" -eq 0 ] && rm -f "$lockfile"
+    # If no signal is specified, -TERM is used but _also_ -KILL 3s later
+    # This is far too aggressive for a cluster resource manager running on top of Corosync
+    killproc $prog -TERM
     echo
-    return $retval
+
+    echo -n $"Waiting for services to unload:"
+    while
+        pidofproc $prog > /dev/null 2>&1
+    do
+        sleep 2
+    done
+
+    success $"$base shutdown"
+    echo
+
+    rm -f "$lockfile"
+    return 0
 }
 
 restart() {