summaryrefslogtreecommitdiffstats
path: root/debian/rspamd.init
diff options
context:
space:
mode:
authorMikhail Gusarov <dottedmag@dottedmag.net>2014-03-06 22:02:50 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-03-08 21:49:18 +0000
commite5f846bd62b5029ddaa1997233e38d6c4c3daf76 (patch)
tree18413829738e007ab8a74eb33449c351e40d338b /debian/rspamd.init
parentd78268251ff4dc3b437aec265194b2fa1a916e34 (diff)
downloadrspamd-e5f846bd62b5029ddaa1997233e38d6c4c3daf76.tar.gz
rspamd-e5f846bd62b5029ddaa1997233e38d6c4c3daf76.zip
Get rid of multiple rspamd instances (use LXC/systemd-nspawn instead)
Diffstat (limited to 'debian/rspamd.init')
-rwxr-xr-xdebian/rspamd.init106
1 files changed, 45 insertions, 61 deletions
diff --git a/debian/rspamd.init b/debian/rspamd.init
index 053dca89e..bd616b83f 100755
--- a/debian/rspamd.init
+++ b/debian/rspamd.init
@@ -36,16 +36,6 @@ RSPAMD_GROUPNAME=_rspamd
# 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
#
@@ -97,64 +87,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