]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | # | |
3 | # stunnel stunnel (Universal SSL tunnel) | |
4 | # | |
5 | # chkconfig: 345 14 91 | |
6 | # | |
7 | # description: stunnel (Universal SSL tunnel) | |
8 | # | |
9 | # id: $Id$ | |
10 | # | |
11 | ||
12 | # Source function library | |
13 | . /etc/rc.d/init.d/functions | |
14 | ||
15 | # Get network config | |
16 | . /etc/sysconfig/network | |
17 | ||
18 | # Get service config | |
19 | [ -f /etc/sysconfig/stunnel ] && . /etc/sysconfig/stunnel | |
20 | ||
21 | # Check that networking is up. | |
22 | if is_yes "${NETWORKING}"; then | |
23 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then | |
24 | msg_network_down stunnel | |
25 | exit 1 | |
26 | fi | |
27 | else | |
28 | exit 0 | |
29 | fi | |
30 | ||
31 | # Daemon doesn't die if config doesn't exist | |
32 | if [ ! -f "$STUNNEL_CONFIG" ]; then | |
33 | nls "%s config %s does not exist." Stunnel "$STUNNEL_CONFIG" | |
34 | exit 1 | |
35 | fi | |
36 | ||
37 | RETVAL=0 | |
38 | # See how we were called. | |
39 | case "$1" in | |
40 | start) | |
41 | # Check if the service is already running? | |
42 | if [ ! -f /var/lock/subsys/stunnel ]; then | |
43 | msg_starting stunnel; busy | |
44 | daemon stunnel $STUNNEL_CONFIG | |
45 | RETVAL=$? | |
46 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/stunnel | |
47 | else | |
48 | msg_already_running stunnel | |
49 | fi | |
50 | ;; | |
51 | stop) | |
52 | if [ -f /var/lock/subsys/stunnel ]; then | |
53 | msg_stopping stunnel | |
54 | killproc stunnel | |
55 | rm -f /var/run/stunnel/stunnel.pid /var/lock/subsys/stunnel >/dev/null 2>&1 | |
56 | else | |
57 | msg_not_running stunnel | |
58 | fi | |
59 | ;; | |
60 | restart|force-reload) | |
61 | $0 stop | |
62 | $0 start | |
63 | exit $? | |
64 | ;; | |
65 | status) | |
66 | status stunnel | |
67 | exit $? | |
68 | ;; | |
69 | *) | |
70 | msg_usage "$0 {start|stop|restart|force-reload|status}" | |
71 | exit 3 | |
72 | esac | |
73 | ||
74 | exit $RETVAL |