]> git.pld-linux.org Git - packages/radsecproxy.git/blob - radsecproxy.init
2a15f18ec996131954469db3e877ec76d3cbf6ec
[packages/radsecproxy.git] / radsecproxy.init
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
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
23 upstart_controlled
24
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
44                 daemon --pidfile /var/run/radsecproxy.pid /usr/sbin/radsecproxy
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
62 condrestart() {
63         if [ -f /var/lock/subsys/radsecproxy ]; then
64                 checkconfig
65                 stop
66                 start
67         else
68                 msg_not_running radsecproxy
69                 RETVAL=$1
70         fi
71 }
72
73 RETVAL=0
74 # See how we were called.
75 case "$1" in
76   start)
77         start
78         ;;
79   stop)
80         stop
81         ;;
82   restart)
83         checkconfig
84         stop
85         start
86         ;;
87   try-restart)
88         condrestart 0
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         ;;
101   status)
102         status radsecproxy
103         exit $?
104         ;;
105   *)
106         msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
107         exit 3
108 esac
109
110 exit $RETVAL
This page took 0.066385 seconds and 2 git commands to generate.