[Groonga-commit] groonga/groonga [master] deb: use inotifywait command to check pid file

Zurück zum Archiv-Index

HAYASHI Kentaro null+****@clear*****
Thu Sep 6 14:32:12 JST 2012


HAYASHI Kentaro	2012-09-06 14:32:12 +0900 (Thu, 06 Sep 2012)

  New Revision: 367e578826493d273737bd56e1f46b758f975189
  https://github.com/groonga/groonga/commit/367e578826493d273737bd56e1f46b758f975189

  Log:
    deb: use inotifywait command to check pid file

  Modified files:
    packages/debian/groonga-httpd.init

  Modified: packages/debian/groonga-httpd.init (+7 -2)
===================================================================
--- packages/debian/groonga-httpd.init    2012-09-06 14:13:06 +0900 (951d3ce)
+++ packages/debian/groonga-httpd.init    2012-09-06 14:32:12 +0900 (b504dbd)
@@ -151,7 +151,7 @@ do_restart() {
     # Starting duplicated master and worker process.
     start-stop-daemon --stop --signal USR2 --quiet --pidfile $PIDFILE --name $NAME
 
-    [ ! -f "$OLD_PIDFILE" ] && sleep $TIMEOUT
+    inotifywait --quiet --event create --timeout 1 $OLD_PIDFILE
     if [ ! -f "$OLD_PIDFILE" ]; then
 	echo "Failed to start new groonga-httpd master."
 	return 1
@@ -162,7 +162,12 @@ do_restart() {
     # Switch worker process.
     kill -WINCH `cat $OLD_PIDFILE`
 
-    [ ! -f "$PIDFILE" ] && sleep $TIMEOUT
+    inotifywait --quiet --event create --timeout 1 $PIDFILE
+    if [ ! -f "$PIDFILE" ]; then
+	echo "Failed to switch worker process."
+	return 2
+    fi
+
     PID=`cat $PIDFILE`
 
     OLD_WORKER_PROCESS=`pgrep -P $OLDPID | grep -v $PID` 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Zurück zum Archiv-Index