]> git.pld-linux.org Git - packages/spamassassin.git/blob - spamassassin-spamd.init
- unify, simplify
[packages/spamassassin.git] / spamassassin-spamd.init
1 #!/bin/sh
2 #
3 # spamassassin This script starts and stops the spamd daemon
4 #
5 # chkconfig: 2345 80 30
6 #
7 # description: spamd is a daemon process which uses SpamAssassin to check \
8 #              email messages for SPAM.  It is normally called by spamc \
9 #              from a MDA.
10 # processname: spamd
11 # pidfile:     /var/run/spamassassin.pid
12
13 # Source function library.
14 . /etc/rc.d/init.d/functions
15
16 # Source networking configuration.
17 . /etc/sysconfig/network
18
19 SPAMD_OPTS="-d -c"
20 # Source configureation.
21 if [ -f /etc/sysconfig/spamd ] ; then
22         . /etc/sysconfig/spamd
23 fi
24
25 # Check that networking is up.
26 if is_no "${NETWORKING}"; then
27         msg_network_down "SpamAssassin"
28         exit 1
29 fi
30
31 start() {
32         # Start daemon.
33         if [ -f /var/lock/subsys/spamd ]; then
34                 msg_already_running "SpamAssassin"
35                 return
36         fi
37
38         msg_starting "SpamAssassin"
39         daemon /usr/sbin/spamd $SPAMD_OPTS
40         RETVAL=$?
41         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/spamd
42 }
43
44 stop() {
45         # Stop daemons.
46         if [ ! -f /var/lock/subsys/spamd ]; then
47                 msg_not_running "SpamAssassin"
48                 return
49         fi
50
51         msg_stopping "SpamAssassin"
52         killproc spamd
53         RETVAL=$?
54         rm -f /var/lock/subsys/spamd
55 }
56
57 # See how we were called.
58 case "$1" in
59   start)
60         start
61         ;;
62   stop)
63         stop
64         ;;
65   restart)
66         stop
67         start
68         ;;
69   status)
70         status spamd
71         ;;
72   *)
73         msg_usage "$0 {start|stop|restart|status}"
74         exit 1
75 esac
76
77 exit $RETVAL
This page took 0.914317 seconds and 4 git commands to generate.