* restart by doing 'sendcommand down 1' which will make citserver restart internaly.
authorWilfried Göesgens <willi@citadel.org>
Sat, 26 Jan 2008 23:57:07 +0000 (23:57 +0000)
committerWilfried Göesgens <willi@citadel.org>
Sat, 26 Jan 2008 23:57:07 +0000 (23:57 +0000)
citadel/debian/citadel.init
citadel/setup.c

index 15dcdbf91039f8fdafc912c3921daa47cd9df25b..918695ac9b64183bacc3d4697dec1d1a3f74df55 100644 (file)
@@ -98,8 +98,13 @@ do_stop()
 # Function that sends a SIGHUP to the daemon/service
 #
 do_reload() {
-        do_stop
-        do_start
+       # Return
+       #   0 if daemon could not be restarted
+       #   1 if daemon has been restarted
+       #   other if a failure occurred
+        if $SENDCOMMAND "DOWN 1" 2>&1|grep '200 Restarting'>/dev/null ; then
+           return 1
+       fi
        return 0
 }
 
@@ -140,25 +145,18 @@ case "$1" in
            echo "Restarting $DESC" "$NAME"
        fi
 
-       do_stop
+       do_reload
 
        if test -n "$MODERN"; then
            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
+               0)
+                   log_end_msg 0
                    ;;
-               *)
+               1)
                # Failed to stop
                    log_end_msg 1
                    ;;
            esac
-       else
-           do_start
        fi
        ;;
   *)
index 48df424963243ba4bbddb4103136c3012e7fbcca..e1623db6c0e89567d5f22e1646a06e9c978d7d5f 100644 (file)
@@ -446,9 +446,12 @@ void install_init_scripts(void)
                                setup_directory
                        );
        fprintf(fp,     "               ;;\n"
-                       "restart)       $0 stop\n"
-                       "               $0 start\n"
-                       "               ;;\n"
+                       "restart)       if $CITADEL_DIR/sendcommand DOWN 1 >/dev/null 2>&1 ; then\n"
+                       "                       echo \"ok\"\n"
+                       "               else\n"
+                       "                       echo \"failed\"\n"
+                       "               fi\n"
+                       "               ;;\n"
                        "*)             echo \"Usage: $0 {start|stop|restart}\"\n"
                        "               exit 1\n"
                        "               ;;\n"