2010-05-11 20:01:56 +02:00
|
|
|
#!/bin/sh
|
2010-05-13 00:39:55 +02:00
|
|
|
|
2010-04-24 11:08:46 +02:00
|
|
|
# Copyright (c) 2008-2010, Nishant Limbachia, Hoffman Estates, IL, USA
|
2010-05-11 20:01:56 +02:00
|
|
|
# /etc/rc.d/rc.clamsmtpd
|
2010-05-13 00:39:55 +02:00
|
|
|
|
2010-04-24 11:08:46 +02:00
|
|
|
# start/stop/restart clamsmtp mail filter daemon
|
|
|
|
|
|
|
|
# To make clamsmtp start automatically at boot, make this
|
|
|
|
# file executable: chmod 755 /etc/rc.d/rc.clamsmtpd
|
|
|
|
# to edit the startup options refer man 8 clamsmtpd
|
2010-05-13 00:39:55 +02:00
|
|
|
|
2010-05-11 20:01:56 +02:00
|
|
|
|
|
|
|
CONFIG="/etc/clamsmtpd.conf"
|
2010-05-11 22:26:33 +02:00
|
|
|
PIDFILE="/var/run/clamav/clamsmtpd.pid"
|
2010-05-11 20:01:56 +02:00
|
|
|
|
|
|
|
clamsmtpd_start() {
|
2010-05-12 17:45:06 +02:00
|
|
|
if [ -f $PIDFILE ]; then
|
|
|
|
echo "Clamsmtp daemon seems to be running with PID: $(cat $PIDFILE)"
|
|
|
|
else
|
|
|
|
echo "Starting clamsmtp daemon"
|
|
|
|
/usr/sbin/clamsmtpd -f $CONFIG -p $PIDFILE
|
|
|
|
fi
|
2010-05-11 20:01:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
clamsmtpd_stop() {
|
2010-05-11 22:26:33 +02:00
|
|
|
if [ -f $PIDFILE ]; then
|
|
|
|
echo "Stopping clamsmtp daemon"
|
2010-04-24 11:08:46 +02:00
|
|
|
kill -s 15 $(cat $PIDFILE) 2> /dev/null
|
2010-05-11 22:26:33 +02:00
|
|
|
else
|
|
|
|
echo "/usr/sbin/clamsmtpd doesn't seem to be running...exiting"
|
|
|
|
exit 1
|
|
|
|
fi
|
2010-05-11 20:01:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
clamsmtpd_restart() {
|
2010-05-11 22:26:33 +02:00
|
|
|
clamsmtpd_stop
|
|
|
|
sleep 5
|
|
|
|
clamsmtpd_start
|
2010-05-11 20:01:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
'start')
|
|
|
|
clamsmtpd_start
|
|
|
|
;;
|
|
|
|
'stop')
|
|
|
|
clamsmtpd_stop
|
|
|
|
;;
|
|
|
|
'restart')
|
|
|
|
clamsmtpd_restart
|
|
|
|
;;
|
2010-05-12 17:45:06 +02:00
|
|
|
*)
|
2010-05-11 20:01:56 +02:00
|
|
|
echo "USAGE: $0 start|stop|restart"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|