rspamd/init

41 lines
808 B
Plaintext
Raw Normal View History

2023-05-16 14:18:41 +00:00
#!/bin/sh
2017-07-23 09:36:36 +00:00
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
2023-05-16 14:18:41 +00:00
if [ -z "$@" ]; then
if [ -n "${ENABLE_CLAMAV}" ]; then
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
2018-07-02 12:13:36 +00:00
fi
2023-05-16 14:18:41 +00:00
# Set password
[ -n "${RSPAMD_PASSWD}" ] && sed -i -e 's/^#\s*password/ password/' -e "s/@PASSWORD@/${RSPAMD_PASSWD}/" /etc/rspamd/rspamd.conf.local.override
2023-05-16 14:50:22 +00:00
mkdir -p /run/rspamd
[ -x /usr/bin/rspamd ] && exec /usr/bin/rspamd -u rspamd -g rspamd -c /etc/rspamd/rspamd.conf -f -p /run/rspamd/rspamd.pid &
2017-07-23 09:36:36 +00:00
wait
else
exec $@
fi