[Groonga-commit] groonga/groonga [master] httpd deb: support to upgrade binary on the fly

Back to archive index

HAYASHI Kentaro null+****@clear*****
Thu Aug 23 17:54:00 JST 2012


HAYASHI Kentaro	2012-08-23 17:54:00 +0900 (Thu, 23 Aug 2012)

  New Revision: 521a2ecb02d6f8fe71b445d7415f1c09512c770d
  https://github.com/groonga/groonga/commit/521a2ecb02d6f8fe71b445d7415f1c09512c770d

  Log:
    httpd deb: support to upgrade binary on the fly
    
    See http://tech.naver.jp/blog/?p=1369 or
    http://wiki.nginx.org/CommandLine#Upgrading_To_a_New_Binary_On_The_Fly
    
    refs #1456

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

  Modified: packages/debian/groonga-httpd.init (+16 -15)
===================================================================
--- packages/debian/groonga-httpd.init    2012-08-23 17:43:37 +0900 (9bf6b86)
+++ packages/debian/groonga-httpd.init    2012-08-23 17:54:00 +0900 (0471570)
@@ -24,6 +24,7 @@ GROUP=groonga
 ADDRESS=127.0.0.1
 PORT=10041
 PIDFILE=/var/run/groonga/$NAME.pid
+OLDPIDFILE=/var/run/groonga/$NAME.pid.oldbin
 SCRIPTNAME=/etc/init.d/$NAME
 OPTION_ARGS=""
 START_STOP_DAEMON_ARGS=""
@@ -137,6 +138,19 @@ do_status() {
     return $?
 }
 
+do_restart() {
+    echo "do_restart"
+    do_start
+    case "$?" in
+	1)
+	    kill -USR2 `cat $PIDFILE`
+	    kill -WINCH `cat $OLDPIDFILE`
+	    kill -QUIT `cat $OLDPIDFILE`
+	    ;;
+    esac
+    return 0
+}
+
 case "$1" in
     start)
 	[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
@@ -161,21 +175,8 @@ case "$1" in
 	;;
     restart)
 	log_daemon_msg "Restarting $DESC" "$NAME"
-	do_stop
-	case "$?" in
-	    0|1)
-		do_start
-		case "$?" in
-		    0) log_end_msg 0 ;;
-		    1) log_end_msg 1 ;; # Old process is still running
-		    *) log_end_msg 1 ;; # Failed to start
-		esac
-		;;
-	    *)
-	  	# Failed to stop
-		log_end_msg 1
-		;;
-	esac
+	do_restart
+	log_end_msg $?
 	;;
     status)
 	do_status
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index