]> source.dussan.org Git - rspamd.git/commitdiff
Get rid of multiple rspamd instances (use LXC/systemd-nspawn instead)
authorMikhail Gusarov <dottedmag@dottedmag.net>
Thu, 6 Mar 2014 21:02:50 +0000 (22:02 +0100)
committerMikhail Gusarov <dottedmag@dottedmag.net>
Thu, 6 Mar 2014 21:02:50 +0000 (22:02 +0100)
debian/rspamd.init

index f50f2455a7910276ce18fd26d1e80b768d0283a1..de01df27f62d8dd94aa3dab42d7c9583df596af3 100755 (executable)
@@ -31,16 +31,6 @@ SCRIPTNAME=/etc/init.d/$NAME
 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
 . /lib/lsb/init-functions
 
-FILES=(/etc/default/rspamd_*.conf)
-# check for alternative config schema
-if [ -r "${FILES[0]}" ]; then
-       CONFIGS=(/etc/default/rspamd_*.conf)
-else
-       CONFIGS=(/etc/default/$NAME)
-fi;
-
-CONFIG_NUM=${#CONFIGS[@]}
-
 #
 # Function that starts the daemon/service
 #
@@ -92,64 +82,58 @@ do_reopenlog() {
        return 0
 }
 
-_retcode=0
-
-for ((i=0; i < $CONFIG_NUM; i++)); do
-  SCRIPT=${CONFIGS[${i}]}
-  . ${SCRIPT}
-  case "$1" in
+case "$1" in
   start)
-       [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
-       do_start
-       case "$?" in
-               0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
-               2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
-       esac
-       ;;
+    [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+    do_start
+    case "$?" in
+      0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+      2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+    esac
+    ;;
   stop)
-       [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
-       do_stop
-       case "$?" in
-               0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
-               2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
-       esac
-       ;;
+    [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+    do_stop
+    case "$?" in
+      0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+      2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+    esac
+    ;;
   status)
-       status_of_proc -p $PIDFILE "$DAEMON" "$NAME" || _retcode=$?
-       ;;
+    status_of_proc -p $PIDFILE "$DAEMON" "$NAME" || exit $?
+    ;;
   reload|force-reload)
-       log_daemon_msg "Reloading $DESC" "$NAME"
-       do_reload
-       log_end_msg $?
-       ;;
+    log_daemon_msg "Reloading $DESC" "$NAME"
+    do_reload
+    log_end_msg $?
+    ;;
   reopenlog)
-       log_daemon_msg "Reopen logs for $DESC" "$NAME"
-       do_reopenlog
-       log_end_msg $?
-       ;;
+    log_daemon_msg "Reopen logs for $DESC" "$NAME"
+    do_reopenlog
+    log_end_msg $?
+    ;;
   restart)
-       log_daemon_msg "Restarting $DESC" "$NAME"
-       do_stop
+    log_daemon_msg "Restarting $DESC" "$NAME"
+    do_stop
+    case "$?" in
+      0|1)
+       do_start
        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
-               ;;
+         0) log_end_msg 0 ;;
+         1) log_end_msg 1 ;; # Old process is still running
+         *) log_end_msg 1 ;; # Failed to start
        esac
        ;;
-  *)
-       echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|reopenlog}" >&2
-       exit 3
+      *)
+       # Failed to stop
+       log_end_msg 1
        ;;
-  esac
-done
-exit $_retcode
-:
+    esac
+    ;;
+  *)
+    echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|reopenlog}" >&2
+    exit 3
+    ;;
+esac
+
+exit 0