]> git.pld-linux.org Git - packages/spamassassin.git/blame - spamassassin-spamd.init
- unify, simplify
[packages/spamassassin.git] / spamassassin-spamd.init
CommitLineData
0af639ae
JR
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.
1d4bbe26 10# processname: spamd
0af639ae
JR
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
8644bd81 19SPAMD_OPTS="-d -c"
0af639ae 20# Source configureation.
8644bd81
ER
21if [ -f /etc/sysconfig/spamd ] ; then
22 . /etc/sysconfig/spamd
0af639ae
JR
23fi
24
25# Check that networking is up.
26if is_no "${NETWORKING}"; then
9186730e 27 msg_network_down "SpamAssassin"
0af639ae
JR
28 exit 1
29fi
30
9302447f 31start() {
0af639ae 32 # Start daemon.
9186730e
ER
33 if [ -f /var/lock/subsys/spamd ]; then
34 msg_already_running "SpamAssassin"
35 return
0af639ae 36 fi
9186730e
ER
37
38 msg_starting "SpamAssassin"
39 daemon /usr/sbin/spamd $SPAMD_OPTS
40 RETVAL=$?
41 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/spamd
9302447f
ER
42}
43
44stop() {
0af639ae 45 # Stop daemons.
9186730e
ER
46 if [ ! -f /var/lock/subsys/spamd ]; then
47 msg_not_running "SpamAssassin"
48 return
0af639ae 49 fi
9186730e
ER
50
51 msg_stopping "SpamAssassin"
52 killproc spamd
53 RETVAL=$?
54 rm -f /var/lock/subsys/spamd
9302447f
ER
55}
56
57# See how we were called.
58case "$1" in
59 start)
60 start
61 ;;
62 stop)
63 stop
0af639ae
JR
64 ;;
65 restart)
9302447f
ER
66 stop
67 start
0af639ae
JR
68 ;;
69 status)
70 status spamd
71 ;;
72 *)
55613dff 73 msg_usage "$0 {start|stop|restart|status}"
0af639ae
JR
74 exit 1
75esac
76
77exit $RETVAL
This page took 0.096899 seconds and 4 git commands to generate.