From d60e5bf52a308d6cff83ae81927042091f4d7aa1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Sat, 26 Jan 2008 23:57:07 +0000 Subject: [PATCH] * restart by doing 'sendcommand down 1' which will make citserver restart internaly. --- citadel/debian/citadel.init | 24 +++++++++++------------- citadel/setup.c | 9 ++++++--- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/citadel/debian/citadel.init b/citadel/debian/citadel.init index 15dcdbf91..918695ac9 100644 --- a/citadel/debian/citadel.init +++ b/citadel/debian/citadel.init @@ -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 ;; *) diff --git a/citadel/setup.c b/citadel/setup.c index 48df42496..e1623db6c 100644 --- a/citadel/setup.c +++ b/citadel/setup.c @@ -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" -- 2.39.2