]> git.pld-linux.org Git - packages/opendkim.git/blob - opendkim.init
PLDize; default configs; init script; rel 0.2 (wip)
[packages/opendkim.git] / opendkim.init
1 #!/bin/sh
2 # opendkim DomainKeys Identified Mail service
3 # chkconfig:    345 85 15
4 # description: OpenDKIM implements the DomainKeys Identified Mail (DKIM)
5 #              service and a milter-based filter application that can plug
6 #              in to any milter-aware MTA.
7 # processname: opendkim
8 # pidfile: /var/run/opendkim/opendkim.pid
9 # config:       /etc/opendkim/opendkim.conf
10
11 # Source function library
12 . /etc/rc.d/init.d/functions
13
14 prog="/usr/sbin/opendkim"
15 svname="opendkim"
16
17 sysconfig="/etc/sysconfig/$svname"
18 lockfile="/var/lock/subsys/$svname"
19 pidfile="/var/run/$svname/$svname.pid"
20 conffile="/etc/opendkim/$svname.conf"
21
22 # Get service config
23 [ -f $sysconfig ] && . $sysconfig
24
25 start() {
26         # Check if the service is already running?
27         if [ ! -f $lockfile ]; then
28                 msg_starting "$svname"
29                 daemon $prog -x $conffile -P $pidfile
30                 RETVAL=$?
31                 [ $RETVAL -eq 0 ] && touch $lockfile
32         else
33                 msg_already_running "$svname"
34         fi
35 }
36
37 stop() {
38         # Stop daemons.
39         if [ -f $lockfile ]; then
40                 msg_stopping "$svname"
41                 killproc -p $pidfile $prog
42                 RETVAL=$?
43                 rm -f $lockfile $pidfile >/dev/null 2>&1
44         else
45                 msg_not_running "$svname"
46         fi
47 }
48
49 reload() {
50         if [ -f $lockfile ]; then
51                 msg_reloading "$svname"
52                 killproc -p $pidfile $prog -HUP
53                 RETVAL=$?
54         else
55                 msg_not_running "$svname"
56                 RETVAL=7
57         fi
58 }
59
60 condrestart() {
61         if [ ! -f $lockfile ]; then
62                 msg_not_running "$svname"
63                 RETVAL=$1
64                 return
65         fi
66         stop
67         start
68 }
69
70 RETVAL=0
71 # See how we were called.
72 case "$1" in
73   start)
74         start
75         ;;
76   stop)
77         stop
78         ;;
79   restart)
80         stop
81         start
82         ;;
83   try-restart)
84         condrestart 0
85         ;;
86   status)
87         status --pidfile $pidfile $svname
88         RETVAL=$?
89         ;;
90   *)
91         msg_usage "$0 {start|stop|restart|try-restart|status}"
92         exit 3
93         ;;
94 esac
95
96 exit $RETVAL
This page took 0.057852 seconds and 3 git commands to generate.