]> git.pld-linux.org Git - packages/radsecproxy.git/blob - radsecproxy.init
- sync with upstream git
[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 # Check that networking is up.
24 if is_yes "${NETWORKING}"; then
25         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
26                 msg_network_down radsecproxy
27                 exit 1
28         fi
29 else
30         exit 0
31 fi
32
33 checkconfig() {
34         /usr/sbin/radsecproxy -p || exit 1
35 }
36
37 start() {
38         checkconfig
39         # Check if the service is already running?
40         if [ ! -f /var/lock/subsys/radsecproxy ]; then
41                 msg_starting radsecproxy
42                 daemon /usr/sbin/radsecproxy -i /var/run/radsecproxy.pid
43                 RETVAL=$?
44                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/radsecproxy
45         else
46                 msg_already_running radsecproxy
47         fi
48 }
49
50 stop() {
51         if [ -f /var/lock/subsys/radsecproxy ]; then
52                 msg_stopping radsecproxy
53                 killproc --pidfile /var/run/radsecproxy.pid radsecproxy
54                 rm -f /var/lock/subsys/radsecproxy >/dev/null 2>&1
55         else
56                 msg_not_running radsecproxy
57         fi
58 }
59
60 condrestart() {
61         if [ -f /var/lock/subsys/radsecproxy ]; then
62                 checkconfig
63                 stop
64                 start
65         else
66                 msg_not_running radsecproxy
67                 RETVAL=$1
68         fi
69 }
70
71 RETVAL=0
72 # See how we were called.
73 case "$1" in
74   start)
75         start
76         ;;
77   stop)
78         stop
79         ;;
80   restart)
81         checkconfig
82         stop
83         start
84         ;;
85   try-restart)
86         condrestart 0
87         ;;
88   reload|force-reload)
89         if [ -f /var/lock/subsys/radsecproxy ]; then
90                 checkconfig
91                 msg_reloading radsecproxy
92                 killproc radsecproxy -HUP
93                 RETVAL=$?
94         else
95                 msg_not_running radsecproxy
96                 exit 7
97         fi
98         ;;
99   status)
100         status radsecproxy
101         exit $?
102         ;;
103   *)
104         msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
105         exit 3
106 esac
107
108 exit $RETVAL
This page took 0.140468 seconds and 3 git commands to generate.