5 # Default-Stop: 0 1 2 4 6
6 # Required-Start: radiusd
7 # Should-Start: $network
8 # Short-Description: Starts Moonshot TIDS
9 # Description: Starts the Moonshot Temporary ID Service
13 # description: Starts the Moonshot Temporary ID Service
15 # Source function library.
16 . /etc/init.d/functions
18 [ -z "$HOME" ] && export HOME=/
21 echo "Usage: $0 {start|stop|status}"
24 # Load the configuration
25 [ -f /etc/sysconfig/tids ] || exit 6
28 # Create the PID and LOG directories
29 [ -d ${TIDS_PIDDIR} ] || mkdir -p ${TIDS_PIDDIR} && chown ${TIDS_USER}:${TIDS_GROUP} ${TIDS_PIDDIR}
30 [ -d ${TIDS_LOGDIR} ] || mkdir -p ${TIDS_LOGDIR} && chown ${TIDS_USER}:${TIDS_GROUP} ${TIDS_LOGDIR}
33 prog=/usr/bin/tids-wrapper
34 PIDFILE="${TIDS_PIDDIR}/tids.pid"
35 LOGFILE="${TIDS_LOGDIR}/tids.log"
37 # Does the trust router and wrapper exist
38 [ -x /usr/bin/tids ] || exit 5
39 [ -x /usr/bin/tids-wrapper ] || exit 5
41 [ -f ${LOGFILE} ] || touch ${LOGFILE} && chown ${TIDS_USER}:${TIDS_GROUP} ${LOGFILE}
43 OPTIONS="${PIDFILE} ${LOGFILE} ${TIDS_SERVER_IP} ${TIDS_GSS_NAME} ${TIDS_SERVER_NAME} ${KEYFILE}"
47 if [ -f ${PIDFILE} ] ;
49 OLD_PID=$(cat "${PIDFILE}")
50 if [ -d "/proc/${OLD_PID}" ] ;
52 echo "Error: TIDS already running" ; exit 1
59 echo "${timestamp} Starting TIDS..." >> ${LOGFILE}
60 echo -n "Starting TIDS..."
61 daemon --user="${TIDS_USER}" --pidfile="{PIDFILE}" "${prog}" "${OPTIONS}"
68 echo "${timestamp} Stopping TIDS..." >> ${LOGFILE}
69 echo -n "Stopping TIDS..."
71 if [ -f "${PIDFILE}" ] ;
73 killproc -p "${PIDFILE}" "${prog}"
76 echo "TIDS does not appear to be running..."
81 PID=$(cat "${PIDFILE}")
83 if [ -d "/proc/${PID}" ] ;
85 echo "TIDS is running (pid ${PID})"
87 if [ -e ${PIDFILE} ] ; then
88 echo "TIDS appears to be dead but its PID file exists"
90 echo "TIDS appears to be stopped"
95 reload | force-reload | condrestart | try-restart)