]>
Commit | Line | Data |
---|---|---|
332a2647 AM |
1 | #!/bin/sh |
2 | # | |
3 | # courier-authlib courier-authlib | |
4 | # | |
5 | # chkconfig: 345 85 15 | |
b9983a0a | 6 | # description: courier-authlib |
332a2647 AM |
7 | # |
8 | ||
9 | # Source function library | |
10 | . /etc/rc.d/init.d/functions | |
11 | ||
12 | # Get network config | |
13 | . /etc/sysconfig/network | |
14 | ||
15 | # Get service config | |
16 | [ -f /etc/sysconfig/courier-authlib ] && . /etc/sysconfig/courier-authlib | |
17 | ||
18 | # Check that networking is up. | |
19 | if is_yes "${NETWORKING}"; then | |
20 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then | |
332a2647 AM |
21 | msg_network_down courier-authlib |
22 | exit 1 | |
23 | fi | |
24 | else | |
25 | exit 0 | |
26 | fi | |
27 | ||
ef33ce83 | 28 | start() { |
332a2647 | 29 | # Check if the service is already running? |
78fe65b9 | 30 | if [ -f /var/lock/subsys/courier-authlib ]; then |
332a2647 | 31 | msg_already_running courier-authlib |
78fe65b9 | 32 | return |
332a2647 | 33 | fi |
78fe65b9 ER |
34 | |
35 | msg_starting courier-authlib | |
36 | daemon /usr/sbin/authdaemond start | |
37 | RETVAL=$? | |
38 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/courier-authlib | |
ef33ce83 ER |
39 | } |
40 | ||
41 | stop() { | |
332a2647 | 42 | # Stop daemons. |
78fe65b9 | 43 | if [ ! -f /var/lock/subsys/courier-authlib ]; then |
332a2647 | 44 | msg_not_running courier-authlib |
78fe65b9 | 45 | return |
332a2647 | 46 | fi |
78fe65b9 ER |
47 | |
48 | msg_stopping courier-authlib | |
49 | daemon /usr/sbin/authdaemond stop | |
50 | rm -f /var/lock/subsys/courier-authlib >/dev/null 2>&1 | |
51 | } | |
52 | ||
53 | reload() { | |
54 | if [ ! -f /var/lock/subsys/courier-authlib ]; then | |
55 | msg_not_running courier-authlib | |
56 | RETVAL=7 | |
57 | return | |
58 | fi | |
59 | ||
60 | msg_reloading courier-authlib | |
61 | daemon /usr/sbin/authdaemond restart | |
62 | RETVAL=$? | |
ef33ce83 ER |
63 | } |
64 | ||
2376db48 ER |
65 | condrestart() { |
66 | if [ ! -f /var/lock/subsys/courier-authlib ]; then | |
67 | msg_not_running courier-authlib | |
68 | RETVAL=$1 | |
69 | return | |
70 | fi | |
71 | ||
72 | stop | |
73 | start | |
74 | } | |
75 | ||
ef33ce83 ER |
76 | RETVAL=0 |
77 | # See how we were called. | |
78 | case "$1" in | |
79 | start) | |
80 | start | |
81 | ;; | |
82 | stop) | |
83 | stop | |
332a2647 | 84 | ;; |
332a2647 | 85 | restart) |
ef33ce83 ER |
86 | stop |
87 | start | |
332a2647 | 88 | ;; |
2376db48 ER |
89 | try-restart) |
90 | condrestart 0 | |
91 | ;; | |
332a2647 | 92 | reload|force-reload|graceful) |
78fe65b9 ER |
93 | reload |
94 | ;; | |
95 | status) | |
96 | status authdaemond | |
97 | RETVAL=$? | |
332a2647 AM |
98 | ;; |
99 | *) | |
2376db48 | 100 | msg_usage "$0 {start|stop|restart|reload|force-reload|graceful|try-restart|status}" |
332a2647 AM |
101 | exit 3 |
102 | ;; | |
103 | esac | |
104 | ||
105 | exit $RETVAL |