]> git.pld-linux.org Git - packages/rspamd.git/blob - rspamd.init
Integrate with the system properly
[packages/rspamd.git] / rspamd.init
1 #!/bin/sh
2 #
3 # rspamd This script starts and stops the rspamd daemon
4 #
5 # chkconfig: 2345 80 30
6 #
7 # description: rspamd is a daemon process which uses rspamd to check \
8 #              email messages for SPAM.  It is normally called by rspamc \
9 #              from a MDA.
10 # processname: rspamd
11 # pidfile:     /var/run/rspamd.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/rspamd ] ; then
22         . /etc/sysconfig/rspamd
23 fi
24
25 # Check that networking is up.
26 if is_no "${NETWORKING}"; then
27         msg_network_down "rspamd"
28         exit 1
29 fi
30
31 start() {
32         # Start daemon.
33         if [ -f /var/lock/subsys/rspamd ]; then
34                 msg_already_running "rspamd"
35                 return
36         fi
37
38         msg_starting "rspamd"
39         daemon /usr/bin/rspamd -u rspamd -g rspamd $RSPAMD_OPTS
40         RETVAL=$?
41         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/rspamd
42 }
43
44 stop() {
45         # Stop daemons.
46         if [ ! -f /var/lock/subsys/rspamd ]; then
47                 msg_not_running "rspamd"
48                 return
49         fi
50
51         msg_stopping "rspamd"
52         killproc rspamd
53         RETVAL=$?
54         rm -f /var/lock/subsys/rspamd
55 }
56
57 condrestart() {
58         if [ ! -f /var/lock/subsys/rspamd ]; then
59                 msg_not_running "rspamd"
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 rspamd
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.060862 seconds and 3 git commands to generate.