mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
run as librenms and background
This commit is contained in:
@ -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}"
|
||||
|
Reference in New Issue
Block a user