From e6e225849b49cbb5cb43f3064d4ce8a1c23c18ec Mon Sep 17 00:00:00 2001 From: Eduardo Date: Fri, 20 Dec 2019 09:18:25 +0000 Subject: [PATCH] Some improvements about the start stop scrip, some times don't work well, now stops and checks the the status ok --- init.d/rc.piler.in | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/init.d/rc.piler.in b/init.d/rc.piler.in index f756b45b..c323fb15 100644 --- a/init.d/rc.piler.in +++ b/init.d/rc.piler.in @@ -28,14 +28,17 @@ start() { } stop() { - echo "stopping $NAME" - kill ${PID_NUMBER} + if [ "$PID_NUMBER" != "" ]; then echo "stopping piler"; kill $PID_NUMBER; fi - if [ $PILER_SMTP_PID != '' ]; then echo "stopping piler-smtp"; kill $PILER_SMTP_PID; fi + if [ "$PILER_SMTP_PID" != "" ]; then echo "stopping piler-smtp"; kill $PILER_SMTP_PID; fi } check_status(){ - test -f /proc/${PID_NUMBER}/status + if [ -f /proc/${PID_NUMBER}/status ]; then + echo "piler is running, pid: ${PID_NUMBER}"; + else + echo "piler is NOT running"; + fi if [ "${PILER_SMTP_PID}" != '' ]; then echo "piler-smtp is running, pid: ${PILER_SMTP_PID}"; @@ -56,10 +59,8 @@ case "$1" in status) if check_status; then - echo "${NAME} is running." exit 0 else - echo "${NAME} is not running." exit 1 fi ;; @@ -77,5 +78,4 @@ case "$1" in *) echo "Usage: $0 start|stop|restart|reload|status" -esac - +esac \ No newline at end of file