postfwd/bin/postfwd-script.sh

67 lines
1.5 KiB
Bash
Raw Normal View History

2013-11-05 16:31:59 +00:00
#!/bin/sh
#
# Startscript for the postfwd daemon
#
# by JPK
PATH=/bin:/usr/bin:/usr/local/bin
# path to program
PFWCMD=/usr/local/postfwd/sbin/postfwd
# rulesetconfig file
PFWCFG=/etc/postfix/postfwd.cf
2013-11-05 16:32:27 +00:00
# pidfile
PFWPID=/var/tmp/postfwd.pid
2013-11-05 16:31:59 +00:00
# daemon settings
PFWUSER=nobody
PFWGROUP=nobody
PFWINET=127.0.0.1
PFWPORT=10040
# recommended extra arguments
PFWARG="--shortlog --summary=600 --cache=600 --cache-rbl-timeout=3600 --cleanup-requests=1200 --cleanup-rbls=1800 --cleanup-rates=1200"
## should be no need to change below
2013-11-05 16:32:27 +00:00
P1="`basename ${PFWCMD}`"
2013-11-05 16:31:59 +00:00
case "$1" in
2013-11-05 16:32:27 +00:00
start*) echo "Starting ${P1}...";
${PFWCMD} ${PFWARG} --daemon --file=${PFWCFG} --interface=${PFWINET} --port=${PFWPORT} --user=${PFWUSER} --group=${PFWGROUP} --pidfile=${PFWPID};
2013-11-05 16:31:59 +00:00
;;
2013-11-05 16:32:27 +00:00
debug*) echo "Starting ${P1} in debug mode...";
${PFWCMD} ${PFWARG} -vv --daemon --file=${PFWCFG} --interface=${PFWINET} --port=${PFWPORT} --user=${PFWUSER} --group=${PFWGROUP} --pidfile=${PFWPID};
;;
2013-11-05 16:31:59 +00:00
2013-11-05 16:32:27 +00:00
stop*) if [ -f "${PFWPID}" ]; then
2013-11-05 16:31:59 +00:00
echo "Stopping ${P1}...";
2013-11-05 16:32:27 +00:00
kill `cat ${PFWPID}`;
else
echo "Pidfile \"${PFWPID}\" not found" ;
false;
2013-11-05 16:31:59 +00:00
fi ;
;;
2013-11-05 16:32:27 +00:00
reload*) if [ -f "${PFWPID}" ]; then
echo "Stopping ${P1}...";
kill -HUP `cat ${PFWPID}`;
2013-11-05 16:31:59 +00:00
else
2013-11-05 16:32:27 +00:00
echo "Pidfile \"${PFWPID}\" not found" ;
false;
2013-11-05 16:31:59 +00:00
fi ;
;;
restart*) $0 stop;
sleep 4;
$0 start;
;;
*) echo "Unknown argument \"$1\"" >&2;
2013-11-05 16:32:27 +00:00
echo "Usage: `basename $0` {start|stop|reload|restart}" >&2;
2013-11-05 16:31:59 +00:00
exit 1;;
esac
exit $?