aboutsummaryrefslogtreecommitdiffstats
path: root/mail/pop3vscan/files/pop3vscan.sh
blob: 8bdbb9892de64ca1ba208983485afc410ebf4c30 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh

if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then
    echo "$0: Cannot determine the PREFIX" >&2
    exit 1
fi

user=pop3vscan
scanner=${PREFIX}/bin/uvscan
virusregexp="^[[:space:]]*Found( the|:)[[:space:]]*(.*)[[:space:]]*(|virus[^a-z.]*)$/2"
template=${PREFIX}/etc/pop3vscan.mail
viruscode=13

case "$1" in
    start)
    echo -n "Starting POP3VScan"
    ${PREFIX}/sbin/pop3vscan --user=${user} --scanner=${scanner} --virusregexp="${virusregexp}" --template=${template} --viruscode=${viruscode} || exit 1
    ;;
    stop)
    echo -n "Shutting down POP3VScan"
    kill `cat /var/run/pop3vscan.pid 2>/dev/null` &>/dev/null || exit 1
    ;;
    reload|restart)
    $0 stop && sleep 1 &&  $0 start || exit 1
    ;;
    *)
    echo "Usage: $0 {start|stop|reload|restart}"
    exit 1
esac

exit 0