summaryrefslogtreecommitdiffstats
path: root/system/initd/init.d
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-05-08 16:27:08 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-05-08 16:27:08 +0000
commit81581f9719bc56f01d5aa08952671d65fda9867a (patch)
tree0f5c6b6138bf169c23c9d24b1fc0a3521385cb18 /system/initd/init.d
parentReleasing debian version 1.38.1-1. (diff)
downloadnetdata-81581f9719bc56f01d5aa08952671d65fda9867a.tar.xz
netdata-81581f9719bc56f01d5aa08952671d65fda9867a.zip
Merging upstream version 1.39.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'system/initd/init.d')
-rw-r--r--system/initd/init.d/netdata.in95
1 files changed, 95 insertions, 0 deletions
diff --git a/system/initd/init.d/netdata.in b/system/initd/init.d/netdata.in
new file mode 100644
index 000000000..c0257ffab
--- /dev/null
+++ b/system/initd/init.d/netdata.in
@@ -0,0 +1,95 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# netdata Real-time performance monitoring, done right
+# chkconfig: 345 99 01
+# description: Netdata is a daemon that collects data in real-time (per second)
+# and presents a web site to view and analyze them. The presentation
+# is also real-time and full of interactive charts that precisely
+# render all collected values.
+# processname: netdata
+
+# Source functions
+. /etc/rc.d/init.d/functions
+
+DAEMON="netdata"
+DAEMON_PATH=@sbindir_POST@
+PIDFILE_PATH=@localstatedir_POST@/run/netdata
+PIDFILE=$PIDFILE_PATH/$DAEMON.pid
+DAEMONOPTS="-P $PIDFILE"
+STOP_TIMEOUT="60"
+
+[ -e /etc/sysconfig/$DAEMON ] && . /etc/sysconfig/$DAEMON
+
+LOCKFILE=/var/lock/subsys/$DAEMON
+
+service_start()
+{
+ [ -x $DAEMON_PATH ] || exit 5
+ [ ! -d $PIDFILE_PATH ] && mkdir -p $PIDFILE_PATH
+ chown @netdata_user_POST@:@netdata_user_POST@ $PIDFILE_PATH
+ echo -n "Starting $DAEMON..."
+ daemon $DAEMON_PATH/$DAEMON $DAEMONOPTS
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && touch $LOCKFILE
+ return $RETVAL
+}
+
+service_stop()
+{
+ printf "%-50s" "Stopping $DAEMON..."
+ killproc -p ${PIDFILE} -d ${STOP_TIMEOUT} $DAEMON
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && rm -f ${PIDFILE} ${LOCKFILE}
+ return $RETVAL
+}
+
+condrestart()
+{
+ if ! service_status > /dev/null; then
+ RETVAL=$1
+ return $RETVAL
+ fi
+
+ service_stop
+ service_start
+}
+
+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)
+ service_stop
+ service_start
+;;
+try-restart)
+ condrestart 0
+ ;;
+force-reload)
+ condrestart 7
+;;
+status)
+ service_status
+;;
+*)
+ echo "Usage: $0 {start|stop|restart|try-restart|force-reload|status}"
+ exit 3
+esac