]>
Commit | Line | Data |
---|---|---|
3b9bb7b8 PG |
1 | #!/bin/sh |
2 | # | |
3 | # radsecproxy radsecproxy (secure radius proxy daemon) | |
4 | # | |
5 | # chkconfig: 345 89 11 | |
6 | # | |
7 | # description: radsecproxy is a generic RADIUS proxy that in addition to to usual \ | |
8 | # RADIUS UDP transport, also supports TLS (RadSec). The aim is for the \ | |
9 | # proxy to have sufficient features to be flexible, while at the same \ | |
10 | # time to be small, efficient and easy to configure. Currently the \ | |
11 | # executable on Linux is only about 48 Kb, and it uses about 64 Kb \ | |
12 | # (depending on the number of peers) while running. \ | |
13 | ||
3b9bb7b8 PG |
14 | # Source function library |
15 | . /etc/rc.d/init.d/functions | |
16 | ||
17 | # Get network config | |
18 | . /etc/sysconfig/network | |
19 | ||
20 | # Get service config | |
21 | [ -f /etc/sysconfig/radsecproxy ] && . /etc/sysconfig/radsecproxy | |
22 | ||
ea7330c0 PG |
23 | upstart_controlled |
24 | ||
3b9bb7b8 PG |
25 | # Check that networking is up. |
26 | if is_yes "${NETWORKING}"; then | |
27 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then | |
28 | msg_network_down radsecproxy | |
29 | exit 1 | |
30 | fi | |
31 | else | |
32 | exit 0 | |
33 | fi | |
34 | ||
35 | checkconfig() { | |
36 | /usr/sbin/radsecproxy -p || exit 1 | |
37 | } | |
38 | ||
39 | start() { | |
40 | checkconfig | |
41 | # Check if the service is already running? | |
42 | if [ ! -f /var/lock/subsys/radsecproxy ]; then | |
43 | msg_starting radsecproxy | |
299059c1 | 44 | daemon /usr/sbin/radsecproxy -i /var/run/radsecproxy.pid |
3b9bb7b8 PG |
45 | RETVAL=$? |
46 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/radsecproxy | |
47 | else | |
48 | msg_already_running radsecproxy | |
49 | fi | |
50 | } | |
51 | ||
52 | stop() { | |
53 | if [ -f /var/lock/subsys/radsecproxy ]; then | |
54 | msg_stopping radsecproxy | |
55 | killproc --pidfile /var/run/radsecproxy.pid radsecproxy | |
56 | rm -f /var/lock/subsys/radsecproxy >/dev/null 2>&1 | |
57 | else | |
58 | msg_not_running radsecproxy | |
59 | fi | |
60 | } | |
61 | ||
077cc0b9 | 62 | condrestart() { |
4fbe4ff3 | 63 | if [ -f /var/lock/subsys/radsecproxy ]; then |
077cc0b9 JB |
64 | checkconfig |
65 | stop | |
66 | start | |
67 | else | |
4fbe4ff3 | 68 | msg_not_running radsecproxy |
077cc0b9 JB |
69 | RETVAL=$1 |
70 | fi | |
71 | } | |
72 | ||
3b9bb7b8 PG |
73 | RETVAL=0 |
74 | # See how we were called. | |
75 | case "$1" in | |
76 | start) | |
077cc0b9 | 77 | start |
3b9bb7b8 PG |
78 | ;; |
79 | stop) | |
077cc0b9 | 80 | stop |
3b9bb7b8 PG |
81 | ;; |
82 | restart) | |
83 | checkconfig | |
84 | stop | |
85 | start | |
86 | ;; | |
077cc0b9 JB |
87 | try-restart) |
88 | condrestart 0 | |
3b9bb7b8 PG |
89 | ;; |
90 | reload|force-reload) | |
91 | if [ -f /var/lock/subsys/radsecproxy ]; then | |
92 | checkconfig | |
93 | msg_reloading radsecproxy | |
94 | killproc radsecproxy -HUP | |
95 | RETVAL=$? | |
96 | else | |
97 | msg_not_running radsecproxy | |
98 | exit 7 | |
99 | fi | |
100 | ;; | |
077cc0b9 JB |
101 | status) |
102 | status radsecproxy | |
103 | exit $? | |
104 | ;; | |
3b9bb7b8 | 105 | *) |
077cc0b9 | 106 | msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}" |
3b9bb7b8 PG |
107 | exit 3 |
108 | esac | |
109 | ||
110 | exit $RETVAL |