rc.piler.in improvements

Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
Janos SUTO 2020-03-14 16:33:11 +01:00
parent bec0c0399e
commit d994f5d1b3

View File

@ -15,9 +15,9 @@
NAME=piler NAME=piler
OPTIONS="" OPTIONS=""
PID_FILE=`SBINDIR/pilerconf $OPTIONS -q pidfile | cut -f2 -d=` PID_FILE="$(SBINDIR/pilerconf $OPTIONS -q pidfile | cut -f2 -d=)"
PID_NUMBER=`test -f ${PID_FILE} && cat ${PID_FILE}` PID_NUMBER="$(test -f "$PID_FILE" && cat "$PID_FILE")"
PILER_SMTP_PID=$(ps uaxw | grep -w piler-smtp | grep -v grep | awk '{print $2}') PILER_SMTP_PID="$(pgrep piler-smtp)"
start() { start() {
echo "starting piler-smtp . . . " echo "starting piler-smtp . . . "
@ -28,13 +28,13 @@ start() {
} }
stop() { stop() {
if [ "$PID_NUMBER" != "" ]; then echo "stopping piler"; kill $PID_NUMBER; fi 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(){ check_status(){
if [ -f /proc/${PID_NUMBER}/status ]; then if [ -f "/proc/${PID_NUMBER}/status" ]; then
echo "piler is running, pid: ${PID_NUMBER}"; echo "piler is running, pid: ${PID_NUMBER}";
else else
echo "piler is NOT running"; echo "piler is NOT running";
@ -72,10 +72,11 @@ case "$1" in
;; ;;
reload) reload)
kill -HUP $PID_NUMBER kill -HUP "$PID_NUMBER"
echo "reloaded" echo "reloaded"
;; ;;
*) *)
echo "Usage: $0 start|stop|restart|reload|status" echo "Usage: $0 start|stop|restart|reload|status"
;;
esac esac