]> arthur.barton.de Git - netdata.git/commitdiff
added LSB (old debian) init script
authorCosta Tsaousis <costa@tsaousis.gr>
Mon, 30 May 2016 23:12:47 +0000 (02:12 +0300)
committerCosta Tsaousis <costa@tsaousis.gr>
Mon, 30 May 2016 23:12:47 +0000 (02:12 +0300)
system/Makefile.am
system/netdata-init-d.in
system/netdata-lsb.in [new file with mode: 0755]
system/netdata.service.in

index f16a720e2d2bdbfe4ff8179a121a3afe657b5e0f..b2e49c5af0f096faf7ab6dab1dbd6ceffc3c5094 100644 (file)
@@ -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)
index 07d5a19ecdb313834fc2316177e224e38963a5e9..d72dd2e56b5b161824b66a9c924b35417651069f 100755 (executable)
@@ -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 (executable)
index 0000000..d816597
--- /dev/null
@@ -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
index 91db6122d8c6a0f8d2ede7f43bdc7c92ebf62aaa..5a119553cb2c804390693288540697c0e3bd9feb 100644 (file)
@@ -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]