3 # ntpd This shell script takes care of starting and stopping
7 # description: trust_router is the GSS-EAP trust routing daemon. \
8 # GSS-EAP is an IETF standard for providing authentication across \
12 # Provides: trust_router
13 # Required-Start: $network $local_fs $remote_fs
14 # Required-Stop: $network $local_fs $remote_fs
15 # Should-Start: $syslog $named ntpdate
16 # Should-Stop: $syslog $named
17 # Short-Description: start and stop trust_router
18 # Description: trust_router is the GSS-EAP trust routing daemon.
19 # GSS-EAP is an IETF standard for providing authentication
20 # across an insecure WAN.
23 # Source function library.
24 . /etc/init.d/functions
26 # Source networking configuration.
27 . /etc/sysconfig/network
29 # Load the instance configuration
30 [ -f /etc/sysconfig/trust_router ] || exit 6
31 . /etc/sysconfig/trust_router
33 # Create the pidfile directory
34 mkdir -p /var/run/trust_router
35 chown trustrouter:trustrouter /var/run/trust_router
37 # Does the trust router and wrapper exist
38 [ -x /usr/bin/trust_router ] || exit 5
39 [ -x /usr/bin/trust_router-wrapper ] || exit 5
41 # Does the tidc client exist
42 [ -x /usr/bin/tidc ] || exit 5
43 [ -x /usr/bin/tidc-wrapper ] || exit 5
45 prog="trust_router-wrapper"
52 [ "${i}" == "${1}" ] && return 0
59 echo -n "Attempting to authenticate to instance ${current_instance}:${current_port}"
61 daemon --user="${current_user}" /usr/bin/tidc-wrapper "${current_test_acceptor}" "${current_test_rprealm}" "${current_test_community}" "${current_test_realm}" "${current_port}"
72 if [ "${TR_CONFIG_USER[${current_instance}]+abc}" ] ;
74 current_user=${TR_CONFIG_USER[${current_instance}]}
76 current_user=${TR_DEFAULT_USER}
79 if [ "${TR_CONFIG_PIDDIR[${current_instance}]+abc}" ] ;
81 current_piddir=${TR_CONFIG_PIDDIR[${current_instance}]}
83 current_piddir=${TR_DEFAULT_PIDDIR}
86 if [ "${TR_CONFIG_CFGDIR[${current_instance}]+abc}" ] ;
88 current_cfgdir=${TR_CONFIG_CFGDIR[${current_instance}]}
90 current_cfgdir=${TR_DEFAULT_CFGDIR}
93 if [ "${TR_CONFIG_LOGDIR[${current_instance}]+abc}" ] ;
95 current_logdir=${TR_CONFIG_LOGDIR[${current_instance}]}
97 current_logdir=${TR_DEFAULT_LOGDIR}
100 if [ "${TR_CONFIG_PORT[${current_instance}]+abc}" ] ;
102 current_port=${TR_CONFIG_PORT[${current_instance}]}
104 current_port=${TR_DEFAULT_PORT}
107 if [ "${TR_CONFIG_AUTOSTART[${current_instance}]+abc}" ] ;
109 current_autostart=${TR_CONFIG_AUTOSTART[${current_instance}]}
111 current_autostart=${TR_DEFAULT_AUTOSTART}
114 if [ "${TR_CONFIG_ACCEPTOR[${current_instance}]+abc}" ] ;
116 current_test_acceptor=${TR_CONFIG_TEST_ACCEPTOR[${current_instance}]}
118 current_test_acceptor=${TR_DEFAULT_TEST_ACCEPTOR}
121 if [ "${TR_CONFIG_RPREALM[${current_instance}]+abc}" ] ;
123 current_test_rprealm=${TR_CONFIG_TEST_RPREALM[${current_instance}]}
125 current_test_rprealm=${TR_DEFAULT_TEST_RPREALM}
128 if [ "${TR_CONFIG_TEST_COMMUNITY[${current_instance}]+abc}" ] ;
130 current_test_community=${TR_CONFIG_TEST_COMMUNITY[${current_instance}]}
132 current_test_community=${TR_DEFAULT_TEST_COMMUNITY}
135 if [ "${TR_CONFIG_TEST_REALM[${current_instance}]+abc}" ] ;
137 current_test_realm=${TR_CONFIG_TEST_REALM[${current_instance}]}
139 current_test_realm=${TR_DEFAULT_TEST_REALM}
144 echo "${current_piddir}/${current_instance}.pid"
148 [ "${EUID}" != "0" ] && exit 4
149 [ "${NETWORKING}" = "no" ] && exit 1
153 for i in "${TR_INSTANCES[@]}"
157 if ${current_autostart} ;
162 echo "Skipping instance ${current_instance}"
166 return "${start_ret}"
170 if array_contains "${1}" "${TR_INSTANCES[@]}" ;
177 echo "Instance ${1} not found..."
184 pidfile=$(get-pidfile)
185 logfile="${current_logdir}/${current_instance}.log"
186 cfgdir="${current_cfgdir}/${current_instance}/"
188 OPTIONS="${pidfile} ${cfgdir} ${logfile}"
190 if [ -f "${pidfile}" ] ;
192 local OLD_PID=$(cat "${pidfile}")
194 if [ -d "/proc/${OLD_PID}" ] ;
196 echo "Instance ${current_instance} is already running..."
198 echo "Removing stale PID file..."
205 echo -n "Starting instance ${current_instance}..."
206 daemon --user="${current_user}" --pidfile="${pidfile}" "${prog}" "${OPTIONS}"
210 # Give it a few seconds for things to settle
218 [ "${EUID}" != "0" ] && exit 4
219 [ "${NETWORKING}" = "no" ] && exit 1
221 for i in "${TR_INSTANCES[@]}"
225 pidfile=$(get-pidfile)
227 if [ -f "${pidfile}" ] ;
231 echo "Instance ${i} does not appear to be running..."
237 if array_contains "${1}" "${TR_INSTANCES[@]}" ;
243 echo "Instance ${1} not found..."
252 if [ -f "$(get-pidfile)" ] ;
254 echo -n "Stopping instance ${current_instance}..."
256 killproc -p "$(get-pidfile)" "${prog}"
259 echo "Instance ${current_instance} does not appear to be running..."
264 [ "${EUID}" != "0" ] && exit 4
265 [ "${NETWORKING}" = "no" ] && exit 1
269 for i in "${TR_INSTANCES[@]}"
281 # See how we were called.
298 restart|force-reload)
306 echo "Usage: ${0} {start|start-single|stop|stop-single|status|restart|force-reload}"