X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=tids.initd;fp=tids.initd;h=3af387abc5ad2a6750b07748802d7d19c3353d37;hb=191e7d97d877ec11e92e0b24bb7f1d06b32d7cdf;hp=764ce1c9070f7207cc59f0ef22d076075ca84dfb;hpb=ad777b89b900a9fee1cc1ea62ca26eb3cf6ab914;p=trust_router.git diff --git a/tids.initd b/tids.initd index 764ce1c..3af387a 100644 --- a/tids.initd +++ b/tids.initd @@ -47,6 +47,7 @@ case "$1" in if [ -f ${PIDFILE} ] ; then OLD_PID=$(cat "${PIDFILE}") + if [ -d "/proc/${OLD_PID}" ] ; then echo "Error: TIDS already running" ; exit 1 @@ -67,28 +68,32 @@ case "$1" in timestamp=$(date) echo "${timestamp} Stopping TIDS..." >> ${LOGFILE} echo -n "Stopping TIDS..." - - if [ -f "${PIDFILE}" ] ; + if [ -f "${PIDFILE}" ] ; then - killproc -p "${PIDFILE}" "${prog}" - echo - else - echo "TIDS does not appear to be running..." - fi + killproc -p "${PIDFILE}" "${prog}" + echo + else + echo "TIDS does not appear to be running" + fi exit $? ;; status) - PID=$(cat "${PIDFILE}") - - if [ -d "/proc/${PID}" ] ; + if [ -f ${PIDFILE} ] ; then - echo "TIDS is running (pid ${PID})" - else - if [ -e ${PIDFILE} ] ; then - echo "TIDS appears to be dead but its PID file exists" + PID=$(cat "${PIDFILE}") + + if [ -d "/proc/${PID}" ] ; + then + echo "TIDS is running (pid ${PID})" else - echo "TIDS appears to be stopped" + if [ -e ${PIDFILE} ] ; then + echo "TIDS appears to be dead but its PID file exists" + else + echo "TIDS appears to be stopped" + fi fi + else + echo "TIDS appears to be stopped" fi exit 0 ;;