Some improvements about the start stop scrip, some times don't work well, now stops and checks the the status ok

This commit is contained in:
Eduardo 2019-12-20 09:18:25 +00:00
parent 4a8baa3b2e
commit e6e225849b

View File

@ -28,14 +28,17 @@ start() {
} }
stop() { stop() {
echo "stopping $NAME" if [ "$PID_NUMBER" != "" ]; then echo "stopping piler"; kill $PID_NUMBER; fi
kill ${PID_NUMBER}
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(){ 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 if [ "${PILER_SMTP_PID}" != '' ]; then
echo "piler-smtp is running, pid: ${PILER_SMTP_PID}"; echo "piler-smtp is running, pid: ${PILER_SMTP_PID}";
@ -56,10 +59,8 @@ case "$1" in
status) status)
if check_status; if check_status;
then then
echo "${NAME} is running."
exit 0 exit 0
else else
echo "${NAME} is not running."
exit 1 exit 1
fi fi
;; ;;
@ -78,4 +79,3 @@ case "$1" in
*) *)
echo "Usage: $0 start|stop|restart|reload|status" echo "Usage: $0 start|stop|restart|reload|status"
esac esac