]>
Commit | Line | Data |
---|---|---|
44a8700b | 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_no "${NETWORKING}"; then | |
23 | msg_network_down stunnel | |
24 | exit 1 | |
25 | fi | |
26 | ||
27 | # Daemon doesn't die if config doesn't exist | |
28 | if [ ! -f $STUNNEL_CONFIG ]; then | |
29 | echo "Stunnel config $STUNNEL_CONFIG does not exist." | |
30 | exit 1 | |
31 | fi | |
32 | ||
33 | # See how we were called. | |
34 | case "$1" in | |
35 | start) | |
36 | # Check if the service is already running? | |
37 | if [ ! -f /var/lock/subsys/stunnel ]; then | |
38 | msg_starting stunnel; busy | |
39 | daemon stunnel $STUNNEL_CONFIG | |
40 | RETVAL=$? | |
41 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/stunnel | |
42 | else | |
43 | msg_already_running stunnel | |
44 | exit 1 | |
45 | fi | |
46 | ;; | |
47 | stop) | |
48 | if [ -f /var/lock/subsys/stunnel ]; then | |
49 | msg_stopping stunnel | |
50 | killproc stunnel | |
51 | rm -f /var/run/stunnel/stunnel.pid /var/lock/subsys/stunnel >/dev/null 2>&1 | |
52 | else | |
53 | msg_not_running stunnel | |
54 | exit 1 | |
55 | fi | |
56 | ;; | |
57 | restart) | |
58 | $0 stop | |
59 | $0 start | |
60 | ;; | |
61 | status) | |
62 | status stunnel | |
63 | exit $? | |
64 | ;; | |
65 | *) | |
66 | msg_usage "$0 {start|stop|status|restart}" | |
67 | exit 1 | |
68 | esac | |
69 | ||
70 | exit $RETVAL |