summaryrefslogtreecommitdiffstats
path: root/system/netdata-init-d.in
diff options
context:
space:
mode:
authorLennart Weller <lhw@ring0.de>2017-01-24 15:21:09 +0000
committerLennart Weller <lhw@ring0.de>2017-01-24 15:21:09 +0000
commit3ed3b02ed96ddab1c084811f3579b3a2aec83e04 (patch)
tree7a61ab288ae47800c4f11be5677d6ad8288dcd98 /system/netdata-init-d.in
parentNew upstream version 1.4.0+dfsg (diff)
downloadnetdata-3ed3b02ed96ddab1c084811f3579b3a2aec83e04.tar.xz
netdata-3ed3b02ed96ddab1c084811f3579b3a2aec83e04.zip
New upstream version 1.5.0+dfsgupstream/1.5.0+dfsg
Diffstat (limited to '')
-rw-r--r--system/netdata-init-d.in19
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)