diff options
author | Ebben Aries <e@dscp.org> | 2018-11-26 22:42:17 +0000 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2018-12-01 07:27:47 +0700 |
commit | c47042f4c58235442a15d152ed97fe9b352d1d0d (patch) | |
tree | 816707047937a3fce5d5a12f8d45bb818f79ecd5 /network/rspamd/rc.rspamd.new | |
parent | 43ab7d5e9cf69fab9a1be83368e6cbb02bc8b342 (diff) | |
download | slackbuilds-c47042f4c58235442a15d152ed97fe9b352d1d0d.tar.gz |
network/rspamd: Updated for version 1.8.2.
Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
Diffstat (limited to 'network/rspamd/rc.rspamd.new')
-rw-r--r-- | network/rspamd/rc.rspamd.new | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/network/rspamd/rc.rspamd.new b/network/rspamd/rc.rspamd.new new file mode 100644 index 0000000000..8c3e78f908 --- /dev/null +++ b/network/rspamd/rc.rspamd.new @@ -0,0 +1,67 @@ +#!/bin/sh +# +# rspamd startup script for Slackware Linux + +NAME=rspamd +DAEMON=/usr/bin/$NAME +RSPAMADM=/usr/bin/rspamadm +PIDFILE=/var/run/rspamd/${NAME}.pid +CONF=/etc/rspamd/rspamd.conf +DAEMON_ARGS="-c $CONF -u $NAME -g $NAME" + +rspamd_start() { + if [ ! -r $CONF ]; then + echo "$CONF does not appear to exist. Abort." + exit 1 + fi + + if [ -s $PIDFILE ]; then + echo "rspamd appears to be already running?" + exit 1 + fi + + echo "Starting rspamd ..." + $DAEMON $DAEMON_ARGS +} + +rspamd_stop() { + if [ ! -s $PIDFILE ]; then + echo "$PIDFILE does not exist or is empty." + exit 1 + fi + + PID=$(cat $PIDFILE) + echo -n "Stopping rspamd ..." + kill -TERM $(cat $PIDFILE) + rm -f $PIDFILE + echo " done" +} + +rspamd_restart() { + rspamd_configtest || return $? + rspamd_stop + sleep 3 + rspamd_start +} + +rspamd_configtest() { + $RSPAMADM configtest -c $CONF +} + +case "$1" in + start) + rspamd_start + ;; + stop) + rspamd_stop + ;; + restart) + rspamd_restart + ;; + configtest) + rspamd_configtest + ;; + *) + echo "Usage: $0 {start|stop|restart|configtest}" + exit 1 +esac |