diff options
author | Lennart Weller <lhw@ring0.de> | 2017-01-24 15:21:16 +0000 |
---|---|---|
committer | Lennart Weller <lhw@ring0.de> | 2017-01-24 15:21:16 +0000 |
commit | ef0c127e7f95d2db2715b9e99fe758eebc7dabd3 (patch) | |
tree | ea5d62342aba06f376f3be63aab898503b56f3ec /system/netdata-init-d.in | |
parent | update watch file and files-exclude (diff) | |
parent | New upstream version 1.5.0+dfsg (diff) | |
download | netdata-ef0c127e7f95d2db2715b9e99fe758eebc7dabd3.tar.xz netdata-ef0c127e7f95d2db2715b9e99fe758eebc7dabd3.zip |
Merge tag 'upstream/1.5.0+dfsg'
Upstream version 1.5.0+dfsg
Diffstat (limited to 'system/netdata-init-d.in')
-rw-r--r-- | system/netdata-init-d.in | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/system/netdata-init-d.in b/system/netdata-init-d.in index edda9950f..468ceee2a 100644 --- a/system/netdata-init-d.in +++ b/system/netdata-init-d.in @@ -17,12 +17,18 @@ PIDFILE=@localstatedir_POST@/run/$DAEMON.pid DAEMONOPTS="-P $PIDFILE" STOP_TIMEOUT="10" +[ -e /etc/sysconfig/$DAEMON ] && . /etc/sysconfig/$DAEMON + +LOCKFILE=/var/lock/subsys/$DAEMON + service_start() { - echo "Starting $DAEMON..." + [ -x $DAEMON_PATH ] || exit 5 + echo -n "Starting $DAEMON..." daemon $DAEMON_PATH/$DAEMON $DAEMONOPTS RETVAL=$? echo + [ $RETVAL -eq 0 ] && touch $LOCKFILE return $RETVAL } @@ -31,10 +37,8 @@ service_stop() printf "%-50s" "Stopping $DAEMON..." killproc -p ${PIDFILE} -d ${STOP_TIMEOUT} $DAEMON RETVAL=$? - if [ $RETVAL -eq 0 ]; then - rm -f ${PIDFILE} - fi echo + [ $RETVAL -eq 0 ] && rm -f ${PIDFILE} ${LOCKFILE} return $RETVAL } @@ -54,11 +58,18 @@ service_status() status -p ${PIDFILE} $DAEMON_PATH/$DAEMON } +service_status_quiet() +{ + status -p ${PIDFILE} $DAEMON_PATH/$DAEMON >/dev/null 2>&1 +} + case "$1" in start) + service_status_quiet && exit 0 service_start ;; stop) + service_status_quiet || exit 0 service_stop ;; restart) |