summaryrefslogtreecommitdiff
path: root/scripts/clamsmtpd.sh
blob: c574e8be2c61a1b52ba8d13ad886649a29206388 (plain)
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
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh

###########################################################################
# CONFIGURATION

# The outgoing SMTP server (CHANGE THIS)
smtp=mysmtp.com:25

# Directory for temporary files (CHANGE THIS)
tmpdir=/var/tmp

# The user to run as
user=clamav

# The prefix clamsmtpd was installed to
prefix=/usr/local/

# The location for pid file
piddir=/var/run/clamav/

# The clamd socket
clamsock=/var/run/clamav/clamd


###########################################################################
# SCRIPT

case $1 in
start)
        mkdir -p $piddir
        chown $user $piddir
        su -m $user -c "$prefix/sbin/clamsmtpd -c $clamsock -D $tmpdir -p $piddir/clamsmtpd.pid $smtp"
        echo -n "clam-smtpd "
        ;;
stop)
        [ -f $piddir/clamsmtpd.pid ] && kill `cat $piddir/clamsmtpd.pid`
        echo -n "clam-smtpd "
        ;;
*)
        echo "usage: clamsmptd.sh {start|stop}" >&2
        ;;
esac