@cryptotaxi247 / netdata-1 / commits / b54acfc3e

added LSB (old debian) init script

Costa Tsaousis committed May 31, 2016 at 02:12 UTC b54acfc3e2c05085782a0a80caa8c3ed8ee25fa1
4 files changed +106 -3
system/Makefile.am
+3
@@ -7,6 +7,7 @@ CLEANFILES = \
7 netdata.logrotate \
8 netdata.service \
9 netdata-init-d \
10 + netdata-lsb \
11 $(NULL)
12
13 include $(top_srcdir)/build/subst.inc
@@ -18,6 +19,7 @@ nodist_noinst_DATA = \
19 netdata.logrotate \
20 netdata.service \
21 netdata-init-d \
22 + netdata-lsb \
23 $(NULL)
24
25 dist_noinst_DATA = \
@@ -25,5 +27,6 @@ dist_noinst_DATA = \
27 netdata.logrotate.in \
28 netdata.service.in \
29 netdata-init-d.in \
30 + netdata-lsb.in \
31 netdata.conf \
32 $(NULL)
system/netdata-init-d.in
+2 -2
@@ -1,8 +1,8 @@
1 #!/bin/sh
2 #
3 -# netdata Real-time charts for system monitoring
3 +# netdata Real-time performance monitoring, done right
4 # chkconfig: 345 99 01
5 -# description: Netdata is a daemon that collects data in realtime (per second)
5 +# description: Netdata is a daemon that collects data in real-time (per second)
6 # and presents a web site to view and analyze them. The presentation
7 # is also real-time and full of interactive charts that precisely
8 # render all collected values.
system/netdata-lsb.in new
+100
@@ -0,0 +1,100 @@
1 +#!/bin/bash
2 +#
3 +### BEGIN INIT INFO
4 +# Provides: netdata
5 +# Required-Start: $local_fs $remote_fs $network $named $time apache2 httpd squid nginx mysql named opensips upsd hostapd postfix lm_sensors
6 +# Required-Stop: $local_fs $remote_fs $network $named $time apache2 httpd squid nginx mysql named opensips upsd hostapd postfix lm_sensors
7 +# Should-Start: $local_fs $network $named $remote_fs $time $all
8 +# Should-Stop: $local_fs $network $named $remote_fs $time $all
9 +# Default-Start: 2 3 4 5
10 +# Default-Stop: 0 1 6
11 +# Short-Description: Start and stop the netdata real-time monitoring server daemon
12 +# Description: Controls the main netdata monitoring server daemon "netdata".
13 +# and all its plugins.
14 +### END INIT INFO
15 +#
16 +set -e
17 +set -u
18 +${DEBIAN_SCRIPT_DEBUG:+ set -v -x}
19 +
20 +DAEMON="netdata"
21 +DAEMON_PATH=@sbindir_POST@
22 +PIDFILE=@localstatedir_POST@/$DAEMON.pid
23 +DAEMONOPTS="-P $PIDFILE"
24 +
25 +test -x $DAEMON_PATH/$DAEMON || exit 0
26 +
27 +. /lib/lsb/init-functions
28 +
29 +# Safeguard (relative paths, core dumps..)
30 +cd /
31 +umask 022
32 +
33 +service_start() {
34 + log_daemon_msg "Starting real-time performance monitoring" "netdata"
35 + start_daemon -p $PIDFILE $DAEMON_PATH/$DAEMON $DAEMONOPTS
36 + RETVAL=$?
37 + log_end_msg $RETVAL
38 + return $RETVAL
39 +}
40 +
41 +service_stop() {
42 + log_daemon_msg "Stopping real-time performance monitoring" "netdata"
43 + killproc -p ${PIDFILE} $DAEMON_PATH/$DAEMON
44 + RETVAL=$?
45 + log_end_msg $RETVAL
46 +
47 + if [ $RETVAL -eq 0 ]; then
48 + rm -f ${PIDFILE}
49 + fi
50 + return $RETVAL
51 +}
52 +
53 +condrestart() {
54 + if ! service_status > /dev/null; then
55 + RETVAL=$1
56 + return
57 + fi
58 +
59 + service_stop
60 + service_start
61 +}
62 +
63 +service_status() {
64 + status_of_proc -p $PIDFILE $DAEMON_PATH/$DAEMON netdata
65 +}
66 +
67 +
68 +#
69 +# main()
70 +#
71 +
72 +case "${1:-''}" in
73 + 'start')
74 + service_start
75 + ;;
76 +
77 + 'stop')
78 + service_stop
79 + ;;
80 +
81 + 'restart')
82 + service_stop
83 + service_start
84 + ;;
85 +
86 + 'try-restart')
87 + condrestart 0
88 + ;;
89 +
90 + 'force-reload')
91 + condrestart 7
92 + ;;
93 +
94 + 'status')
95 + service_status && exit 0 || exit $?
96 + ;;
97 + *)
98 + echo "Usage: $0 {start|stop|restart|try-restart|force-reload|status}"
99 + exit 1
100 +esac
system/netdata.service.in
+1 -1
@@ -1,5 +1,5 @@
1 [Unit]
2 -Description=Linux real time system monitoring, over the web
2 +Description=Linux real time system monitoring, done right
3 After=network.target httpd.service squid.service nfs-server.service mysqld.service named.service postfix.service
4
5 [Service]