Revision: 3061
          http://gar.svn.sourceforge.net/gar/?rev=3061&view=rev
Author:   aigoshin
Date:     2009-02-11 19:17:34 +0000 (Wed, 11 Feb 2009)

Log Message:
-----------
nginx: milestone 2.4

Modified Paths:
--------------
    csw/mgar/pkg/nginx/trunk/files/CSWnginx.postinstall
    csw/mgar/pkg/nginx/trunk/files/svc-cswnginx

Modified: csw/mgar/pkg/nginx/trunk/files/CSWnginx.postinstall
===================================================================
--- csw/mgar/pkg/nginx/trunk/files/CSWnginx.postinstall 2009-02-11 18:02:39 UTC 
(rev 3060)
+++ csw/mgar/pkg/nginx/trunk/files/CSWnginx.postinstall 2009-02-11 19:17:34 UTC 
(rev 3061)
@@ -4,42 +4,50 @@
 
#################################################################################
 
 if [ $UPGRADE_NGINX -eq 1 ]; then
+       MSG=""
        UPGRADE_NGINX_ERR=0
-       if [ -x "$BASEDIR/opt/csw/lib/svc/method/svc-cswnginx" ]; then
-               MSG=`$BASEDIR/opt/csw/lib/svc/method/svc-cswnginx upgrade`
-               if [ $? -eq 0 ]; then
-                       echo " "
-                       echo "nginx was upgraded"
-               else
+       if [ "$SMF" = "yes" ]; then
+               CSWNGINX="$BASEDIR/opt/csw/lib/svc/method/svc-cswnginx"
+       else
+               CSWNGINX="$BASEDIR/etc/init.d/cswnginx"
+       fi
+       if [ -x $CSWNGINX ]; then
+               MSG=`$CSWNGINX upgrade`
+               if [ $? -ne 0 ]; then
                        UPGRADE_NGINX_ERR=1
                fi
-       else
-               if [ -x $BASEDIR/etc/init.d/cswnginx ]; then
-                       MSG=`$BASEDIR/etc/init.d/cswnginx upgrade`
-                       if [ $? -eq 0 ]; then
-                               echo " "
-                               echo "nginx was upgraded"
-                       else
-                               UPGRADE_NGINX_ERR=1
-                       fi
-               else
-                       echo " "
-                       echo "nginx was NOT upgraded"
-               fi
        fi
 
-       if [ $UPGRADE_NGINX_ERR -eq 1 ]; then
+       if [ $UPGRADE_NGINX_ERR -eq 0 ]; then
                echo " "
+               echo "nginx was upgraded"
+               echo " "
+               echo "If this new version of nginx works properly please run"
+               echo "'$CSWNGINX upgrade-commit'"
+               echo "to finalize the online upgrade process."
+               echo " "
+               echo "If there are problems with new version you can rollback"
+               echo "to the old version (which is still running) by command"
+               echo "'$CSWNGINX upgrade-rollback'"
+               echo "and subsequent reinstallation of the old package."
+               echo " "
+               echo "More details can be found in the nginx documentation:"
+               echo "http://sysoev.ru/nginx/docs/control.html";
+       else
+               echo " "
                echo "nginx was NOT upgraded"
                echo "$MSG"
        fi
 else
        echo " "
-       echo "This package may use online upgrade feature of nginx which"
-       echo "allows not to interrupt the processing of clients requests"
-       echo "during the nginx version upgrade."
-       echo "To use it you should install the package over the existing"
-       echo "version (without removing)."
+       echo "This package may use online upgrade feature of nginx which allows"
+       echo "not to interrupt the processing of clients requests during the 
nginx"
+       echo "version upgrade. To use it you should install the package over 
the"
+       echo "existing version (without preliminary removing)."
+       echo " "
+       echo "NOTE: if you wish to take advantage of nginx online upgrade 
feature"
+       echo "you should NOT use CSW automatic package update since it 
sequently"
+       echo "runs pkgrm/pkgadd."
 fi
 
 
#################################################################################

Modified: csw/mgar/pkg/nginx/trunk/files/svc-cswnginx
===================================================================
--- csw/mgar/pkg/nginx/trunk/files/svc-cswnginx 2009-02-11 18:02:39 UTC (rev 
3060)
+++ csw/mgar/pkg/nginx/trunk/files/svc-cswnginx 2009-02-11 19:17:34 UTC (rev 
3061)
@@ -9,8 +9,8 @@
 PIDFILE=${VARRUNX}/nginx.pid
 PIDFILO=${VARRUNX}/nginx.pid.oldbin
 
-[ ! -f ${NGINX} ]   && exit $NGINX
-[ ! -f ${CFGFILE} ] && exit $CFGFILE
+#[ ! -f ${NGINX} ]   && exit 255
+#[ ! -f ${CFGFILE} ] && exit 254
 
 
 start() {
@@ -80,8 +80,10 @@
        COMM=`/bin/ps -o comm= -p $FPID`
        if [ "$NGINX" = "$COMM" ]; then
                echo "running"
+               return 0
        else
                echo "running, but it is not a CSW package"
+               return 1
        fi
 }
 
@@ -89,10 +91,47 @@
 {
        killpidf -USR2
        RETVAL=$?
+       [ $RETVAL -ne 0 ] && return $RETVAL
+       OLDBINPID=0
+       for i in 1 2 3 4 5; do
+               if [ -f $PIDFILO ]; then
+                       OLDBINPID=1
+                       break
+               else
+                       sleep 1
+               fi
+       done
+       if [ $OLDBINPID -eq 1 ]; then
+               state >/dev/null
+               RETVAL=$?
+               if [ $RETVAL -eq 0 ]; then
+                       killpidf -WINCH $PIDFILO
+                       RETVAL=$?
+               fi
+               return $RETVAL
+       fi
+       return 1
+}
+
+upgrade_commit()
+{
+       killpidf -QUIT $PIDFILO
+       RETVAL=$?
        return $RETVAL
 }
 
+upgrade_rollback()
+{
+       killpidf -HUP $PIDFILO
+       RETVAL=$?
+       if [ $RETVAL -eq 0 ]; then
+               killpidf -QUIT $PIDFILE
+               RETVAL=$?
+       fi
+       return $RETVAL
+}
 
+
 case "$1" in
 start)
        [ ! -d $VARRUNX ] && /bin/mkdir -p $VARRUNX
@@ -126,8 +165,16 @@
        RETVAL=$?
        [ $RETVAL -eq 0 ] && upgrade ||:
        ;;
+upgrade-commit)
+       upgrade_commit
+       RETVAL=$?
+       ;;
+upgrade-rollback)
+       upgrade_rollback
+       RETVAL=$?
+       ;;
 *)
-       echo "Usage: $0 
{start|stop|refresh|reload|restart|rotate|state|upgrade}"
+       echo "Usage:" `basename $0` 
"{start|stop|refresh|reload|restart|rotate|state|upgrade|upgrade-commit|upgrade-rollback}"
        exit 1
        ;;
 esac


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.
_______________________________________________
devel mailing list
devel@lists.opencsw.org
https://lists.opencsw.org/mailman/listinfo/devel

Reply via email to