rspamd/init

24 lines
563 B
Plaintext
Raw Normal View History

2017-07-23 09:36:36 +00:00
#!/bin/bash
set -e
NAME="RSPAMD"
2018-01-30 23:14:07 +00:00
CLAMAV="clamav"
WAIT=15
TRIES=5
2017-07-23 09:36:36 +00:00
function stop {
echo "Stopping ${NAME}"
kill $(cat /var/run/rspamd.pid)
}
trap 'stop' SIGTERM
if [ "$1" == "start" ]; then
2018-01-30 23:14:07 +00:00
x=0; until ping -c1 ${CLAMAV} &>/dev/null; do echo "Waiting for [${CLAMAV}]..."; let x=$x+1; if [ $x -ge ${TRIES} ]; then NOTON=1; break; fi ; sleep ${WAIT}; done ; [ -n "${NOTON}" ] && echo "No [${CLAMAV}]?" && exit 1
[ -x /usr/bin/rspamd ] && exec /usr/bin/rspamd -u _rspamd -g _rspamd -c /etc/rspamd/rspamd.conf -f -p /var/run/rspamd.pid &
2017-07-23 09:36:36 +00:00
wait
else
exec $@
fi