From: Mikhail Gusarov Date: Thu, 6 Mar 2014 21:02:50 +0000 (+0100) Subject: Get rid of multiple rspamd instances (use LXC/systemd-nspawn instead) X-Git-Tag: 0.6.9~8^2^2~12 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ffd2caaac5c4b55ee20b089eefae52a8247853af;p=rspamd.git Get rid of multiple rspamd instances (use LXC/systemd-nspawn instead) --- diff --git a/debian/rspamd.init b/debian/rspamd.init index f50f2455a..de01df27f 100755 --- a/debian/rspamd.init +++ b/debian/rspamd.init @@ -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