summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Weller <lhw@ring0.de>2017-07-27 14:17:18 +0000
committerLennart Weller <lhw@ring0.de>2017-07-27 14:17:18 +0000
commitd072fac0a96054a614803dbc1e06fb48945ce943 (patch)
tree2d242f8f7d4b95ec31e6f273989256cdcc93cff8
parentprivacy breach removed and new standard version (diff)
downloadnetdata-d072fac0a96054a614803dbc1e06fb48945ce943.tar.xz
netdata-d072fac0a96054a614803dbc1e06fb48945ce943.zip
fix the sysvinit start/stop issue
-rw-r--r--debian/changelog1
-rw-r--r--debian/netdata.init39
2 files changed, 10 insertions, 30 deletions
diff --git a/debian/changelog b/debian/changelog
index fc077df1f..aa7e3cbd7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
netdata (1.7.0+dfsg-1) UNRELEASED; urgency=medium
* New upstream release (Closes: #868662)
+ * Rudimentary solution to the sysvinit conundrum (Closes: #861713)
-- Lennart Weller <lhw@ring0.de> Thu, 27 Jul 2017 11:57:13 +0200
diff --git a/debian/netdata.init b/debian/netdata.init
index 731ba47fd..1873843fb 100644
--- a/debian/netdata.init
+++ b/debian/netdata.init
@@ -23,7 +23,7 @@
. /lib/lsb/init-functions
NAME=netdata
-PIDFILE=/var/run/netdata.pid
+PIDFILE=/run/netdata.pid
DAEMON=/usr/sbin/$NAME
DAEMON_USER=$NAME
DAEMON_ARGS="-P $PIDFILE"
@@ -35,6 +35,8 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin
DESC="the netdata daemon"
CONF_FNAME=/etc/netdata/netdata.conf
+STOP_SCHEDULE="${STOP_SCHEDULE:-QUIT/5/TERM/5/KILL/5}"
+
case "$1" in
start)
if [ ! -f "$CONF_FNAME" ]; then
@@ -44,16 +46,15 @@ case "$1" in
log_action_begin_msg "Starting $DESC"
- if start-stop-daemon --stop --signal 0 --quiet --pidfile $PIDFILE --exec $DAEMON; then
- log_action_end_msg 0 "already running"
- else
- if start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_ARGS
- then
+ if start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON --test; then
+ if start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON -- $DAEMON_ARGS; then
log_action_end_msg 0
else
log_action_end_msg 1
exit 1
fi
+ else
+ log_action_end_msg 0 "already running"
fi
;;
stop)
@@ -64,30 +65,8 @@ case "$1" in
exit 0
fi
- if start-stop-daemon --stop --signal INT --quiet --pidfile $PIDFILE --exec $DAEMON; then
- true
- elif kill -0 $pid 2>/dev/null; then
- log_action_end_msg 1 "Is $pid not $NAME? Is $DAEMON a different binary now?"
- exit 1
- else
- log_action_end_msg 1 "$DAEMON died: process $pid not running; or permission denied"
- exit 1
- fi
- ;;
- reload)
- log_action_begin_msg "Reloading $DESC configuration"
- pid=`cat $PIDFILE 2>/dev/null` || true
- if test ! -f $PIDFILE -o -z "$pid"; then
- log_action_end_msg 1 "not running - there is no $PIDFILE"
- exit 1
- fi
-
- if start-stop-daemon --stop --signal HUP --quiet --pidfile $PIDFILE --exec $DAEMON
- then
- log_action_end_msg 0
- elif kill -0 $pid 2>/dev/null; then
- log_action_end_msg 1 "Is $pid not $NAME? Is $DAEMON a different binary now?"
- exit 1
+ if start-stop-daemon --stop --quiet --pidfile $PIDFILE --retry=$STOP_SCHEDULE; then
+ log_action_end_msg 0
else
log_action_end_msg 1 "$DAEMON died: process $pid not running; or permission denied"
exit 1