]>
Commit | Line | Data |
---|---|---|
f3528343 | 1 | #!/bin/sh |
2 | # | |
3 | # srsd srsd server | |
4 | # | |
5 | # chkconfig: 345 85 15 | |
6 | # description: srsd is an SRS address rewriting daemon | |
7 | # processname: srsd | |
8 | ||
f3528343 | 9 | # Source function library |
10 | . /etc/rc.d/init.d/functions | |
11 | ||
12 | # Get network config | |
13 | . /etc/sysconfig/network | |
14 | ||
15 | # set defaults | |
12f60fd5 | 16 | SRSD_SECRET="/etc/srsd.secret" |
17 | SRSD_OLDSECRET="/etc/srsd.secret.1" | |
18 | SRSD_OPTIONS='' | |
19 | ||
dfc6dcee | 20 | # Get service config |
21 | [ -f /etc/sysconfig/srsd ] && . /etc/sysconfig/srsd | |
22 | ||
12f60fd5 | 23 | |
24 | if [ -f "$SRSD_SECRET" ]; then | |
dfc6dcee | 25 | SRSD_OPTIONS="$SRSD_OPTIONS --secretfile $SRSD_SECRET" |
12f60fd5 | 26 | fi |
f3528343 | 27 | |
dfc6dcee | 28 | if [ -f "$SRSD_OLDSECRET" ]; then |
29 | SRSD_OPTIONS="$SRSD_OPTIONS --secretfile $SRSD_OLDSECRET" | |
30 | fi | |
f3528343 | 31 | |
32 | # Check that networking is up. | |
33 | if is_yes "${NETWORKING}"; then | |
34 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then | |
35 | # nls "ERROR: Networking is down. %s can't be run." <service> | |
36 | msg_network_down srsd | |
37 | exit 1 | |
38 | fi | |
39 | else | |
40 | exit 0 | |
41 | fi | |
42 | ||
43 | RETVAL=0 | |
44 | # See how we were called. | |
45 | case "$1" in | |
46 | start) | |
47 | # Check if the service is already running? | |
48 | if [ ! -f /var/lock/subsys/srsd ]; then | |
49 | msg_starting srs | |
dfc6dcee | 50 | daemon "sh -c 'srsd $SRSD_OPTIONS &'" |
f3528343 | 51 | RETVAL=$? |
52 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/srsd | |
53 | else | |
54 | msg_already_running srsd | |
55 | fi | |
56 | ;; | |
57 | stop) | |
58 | # Stop daemons. | |
59 | if [ -f /var/lock/subsys/srsd ]; then | |
60 | msg_stopping srsd | |
61 | killproc srsd | |
62 | rm -f /var/lock/subsys/srsd > /dev/null 2>&1 | |
63 | else | |
64 | msg_not_running srsd | |
65 | fi | |
66 | ;; | |
67 | status) | |
68 | status srsd | |
69 | exit $? | |
70 | ;; | |
71 | restart|force-reload) | |
72 | $0 stop | |
73 | $0 start | |
74 | exit $? | |
75 | ;; | |
76 | *) | |
77 | msg_usage "$0 {start|stop|restart|force-reload|status}" | |
78 | exit 3 | |
79 | esac | |
80 | ||
81 | exit $RETVAL |