]> git.pld-linux.org Git - packages/spamassassin.git/blob - spamassassin-spamd.init
- up to 3.3.0 (rules no longer distributed with package itself)
[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/bin/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 condrestart() {
58         if [ ! -f /var/lock/subsys/spamd ]; then
59                 msg_not_running "SpamAssassin"
60                 RETVAL=$1
61                 return
62         fi
63
64         stop
65         start
66 }
67
68 # See how we were called.
69 case "$1" in
70   start)
71         start
72         ;;
73   stop)
74         stop
75         ;;
76   restart)
77         stop
78         start
79         ;;
80   try-restart)
81         condrestart 0
82         ;;
83   force-reload)
84         condrestart 7
85         ;;
86   status)
87         status spamd
88         ;;
89   *)
90         msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
91         exit 1
92 esac
93
94 exit $RETVAL
This page took 0.096536 seconds and 3 git commands to generate.