run as librenms and background

This commit is contained in:
Clint Armstrong
2015-07-23 15:03:01 -04:00
parent 92177414ad
commit 29a6f1b057

View File

@ -15,6 +15,8 @@ NAME=poller-service
DAEMON=/opt/librenms/poller-service.py
USER=librenms
PIDFILE=/var/run/poller-service.pid
test -x $DAEMON || exit 5
@ -34,7 +36,7 @@ case $1 in
log_daemon_msg "Starting the process" "$NAME"
# Start the daemon with the help of start-stop-daemon
# Log the message appropriately
if start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON ; then
if start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON --chuid $USER --background; then
log_end_msg 0
else
log_end_msg 1
@ -69,17 +71,6 @@ case $1 in
fi
;;
reload)
# Reload the process. Basically sending some signal to a daemon to reload
# it configurations.
if [ -e $PIDFILE ]; then
start-stop-daemon --stop --signal USR1 --quiet --pidfile $PIDFILE --name $NAME
log_success_msg "$NAME process reloaded successfully"
else
log_failure_msg "$PIDFILE does not exists"
fi
;;
*)
# For invalid arguments, print the usage message.
echo "Usage: $0 {start|stop|restart|reload|status}"