summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCosta Tsaousis <costa@tsaousis.gr>2016-05-31 02:12:47 +0300
committerCosta Tsaousis <costa@tsaousis.gr>2016-05-31 02:12:47 +0300
commitb54acfc3e2c05085782a0a80caa8c3ed8ee25fa1 (patch)
tree144cf8d349a4bfc81211a9a0b761a7df12fa018c
parentb6d2dc322241228825a98037b258d2b10d969738 (diff)
added LSB (old debian) init script
-rw-r--r--system/Makefile.am3
-rwxr-xr-xsystem/netdata-init-d.in4
-rwxr-xr-xsystem/netdata-lsb.in100
-rw-r--r--system/netdata.service.in2
4 files changed, 106 insertions, 3 deletions
diff --git a/system/Makefile.am b/system/Makefile.am
index f16a720e2d..b2e49c5af0 100644
--- a/system/Makefile.am
+++ b/system/Makefile.am
@@ -7,6 +7,7 @@ CLEANFILES = \
netdata.logrotate \
netdata.service \
netdata-init-d \
+ netdata-lsb \
$(NULL)
include $(top_srcdir)/build/subst.inc
@@ -18,6 +19,7 @@ nodist_noinst_DATA = \
netdata.logrotate \
netdata.service \
netdata-init-d \
+ netdata-lsb \
$(NULL)
dist_noinst_DATA = \
@@ -25,5 +27,6 @@ dist_noinst_DATA = \
netdata.logrotate.in \
netdata.service.in \
netdata-init-d.in \
+ netdata-lsb.in \
netdata.conf \
$(NULL)
diff --git a/system/netdata-init-d.in b/system/netdata-init-d.in
index 07d5a19ecd..d72dd2e56b 100755
--- a/system/netdata-init-d.in
+++ b/system/netdata-init-d.in
@@ -1,8 +1,8 @@
#!/bin/sh
#
-# netdata Real-time charts for system monitoring
+# netdata Real-time performance monitoring, done right
# chkconfig: 345 99 01
-# description: Netdata is a daemon that collects data in realtime (per second)
+# 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.
diff --git a/system/netdata-lsb.in b/system/netdata-lsb.in
new file mode 100755
index 0000000000..d81659775b
--- /dev/null
+++ b/system/netdata-lsb.in
@@ -0,0 +1,100 @@
+#!/bin/bash
+#
+### BEGIN INIT INFO
+# Provides: netdata
+# Required-Start: $local_fs $remote_fs $network $named $time apache2 httpd squid nginx mysql named opensips upsd hostapd postfix lm_sensors
+# Required-Stop: $local_fs $remote_fs $network $named $time apache2 httpd squid nginx mysql named opensips upsd hostapd postfix lm_sensors
+# Should-Start: $local_fs $network $named $remote_fs $time $all
+# Should-Stop: $local_fs $network $named $remote_fs $time $all
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Start and stop the netdata real-time monitoring server daemon
+# Description: Controls the main netdata monitoring server daemon "netdata".
+# and all its plugins.
+### END INIT INFO
+#
+set -e
+set -u
+${DEBIAN_SCRIPT_DEBUG:+ set -v -x}
+
+DAEMON="netdata"
+DAEMON_PATH=@sbindir_POST@
+PIDFILE=@localstatedir_POST@/$DAEMON.pid
+DAEMONOPTS="-P $PIDFILE"
+
+test -x $DAEMON_PATH/$DAEMON || exit 0
+
+. /lib/lsb/init-functions
+
+# Safeguard (relative paths, core dumps..)
+cd /
+umask 022
+
+service_start() {
+ log_daemon_msg "Starting real-time performance monitoring" "netdata"
+ start_daemon -p $PIDFILE $DAEMON_PATH/$DAEMON $DAEMONOPTS
+ RETVAL=$?
+ log_end_msg $RETVAL
+ return $RETVAL
+}
+
+service_stop() {
+ log_daemon_msg "Stopping real-time performance monitoring" "netdata"
+ killproc -p ${PIDFILE} $DAEMON_PATH/$DAEMON
+ RETVAL=$?
+ log_end_msg $RETVAL
+
+ if [ $RETVAL -eq 0 ]; then
+ rm -f ${PIDFILE}
+ fi
+ return $RETVAL
+}
+
+condrestart() {
+ if ! service_status > /dev/null; then
+ RETVAL=$1
+ return
+ fi
+
+ service_stop
+ service_start
+}
+
+service_status() {
+ status_of_proc -p $PIDFILE $DAEMON_PATH/$DAEMON netdata
+}
+
+
+#
+# main()
+#
+
+case "${1:-''}" in
+ 'start')
+ service_start
+ ;;
+
+ 'stop')
+ service_stop
+ ;;
+
+ 'restart')
+ service_stop
+ service_start
+ ;;
+
+ 'try-restart')
+ condrestart 0
+ ;;
+
+ 'force-reload')
+ condrestart 7
+ ;;
+
+ 'status')
+ service_status && exit 0 || exit $?
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|try-restart|force-reload|status}"
+ exit 1
+esac
diff --git a/system/netdata.service.in b/system/netdata.service.in
index 91db6122d8..5a119553cb 100644
--- a/system/netdata.service.in
+++ b/system/netdata.service.in
@@ -1,5 +1,5 @@
[Unit]
-Description=Linux real time system monitoring, over the web
+Description=Linux real time system monitoring, done right
After=network.target httpd.service squid.service nfs-server.service mysqld.service named.service postfix.service
[Service]