]> git.pld-linux.org Git - packages/courier-imap.git/blob - courier-imap-authdaemon.init
- fixed exit code wrapping while authdaemon restart
[packages/courier-imap.git] / courier-imap-authdaemon.init
1 #!/bin/sh
2 # IMAP Auth Daemon
3 #
4 # chkconfig:    345 80 20
5 # description:  IMAP Auth Daemon
6
7 # Source function library
8 . /etc/rc.d/init.d/functions
9
10 # Get network config
11 . /etc/sysconfig/network
12
13 METHOD="plain"
14
15 [ -f /etc/sysconfig/authdaemon ] && . /etc/sysconfig/authdaemon
16
17 # Check that networking is up.
18 if is_no "${NETWORKING}" ; then
19         msg_network_down "Courier IMAP - Authdaemon"
20         exit 1
21 fi
22
23 # See how we were called.
24 case "$1" in
25   start)
26         # Check if the service is already running?
27         if [ ! -f /var/lock/subsys/authdaemon ]; then
28                 msg_starting "Courier IMAP - Authdaemon"
29                 daemon /usr/lib/courier-imap/authlib/authdaemond.$METHOD start
30                 RETVAL=$?
31                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/authdaemon
32         else
33                 msg_already_running "Courier IMAP - Authdaemon"
34                 exit 1
35         fi
36         ;;
37   stop)
38         if [ -f /var/lock/subsys/authdaemon ]; then
39                 msg_stopping "Courier IMAP - Authdaemon"
40                 daemon /usr/lib/courier-imap/authlib/authdaemond.$METHOD stop
41                 RETVAL=$?
42                 rm -f /var/lock/subsys/authdaemon
43         else
44                 msg_not_running "Courier IMAP - Authdaemon"
45                 exit 1
46         fi
47         ;;
48   restart|reload)
49         # restart related services, if running..
50         if [ -f /var/lock/subsys/courier-mta -a \
51              -x /etc/rc.d/init.d/courier-mta ]; then
52             /etc/rc.d/init.d/courier-mta stop
53             crun=1
54         fi
55         if [ -f /var/lock/subsys/courier-imap -a \
56              -x /etc/rc.d/init.d/courier-imap ]; then
57             /etc/rc.d/init.d/courier-imap stop
58             imaprun=1
59         fi
60         if [ -f /var/lock/subsys/courier-imap-pop3 -a \
61              -x /etc/rc.d/init.d/courier-imap-pop3 ]; then
62             /etc/rc.d/init.d/courier-imap-pop3 stop
63             poprun=1
64         fi
65         $0 stop
66         $0 start
67         RETVAL=$?
68         [[ $imaprun -eq 1 ]] && /etc/rc.d/init.d/courier-imap start
69         [[ $poprun -eq 1 ]] && /etc/rc.d/init.d/courier-imap-pop3 start
70         [[ $crun -eq 1 ]] && /etc/rc.d/init.d/courier-mta start
71         unset crun
72         unset poprun
73         unset imaprun
74         ;;
75   status)
76         status authdaemond.$METHOD
77         ;;
78   *)
79         msg_usage "$0 {start|stop|restart|reload|status}"
80         exit 1
81 esac
82
83 exit $RETVAL
84
This page took 0.051508 seconds and 3 git commands to generate.