summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorLennart Weller <lhw@ring0.de>2016-04-21 12:27:29 +0000
committerLennart Weller <lhw@ring0.de>2016-04-21 12:27:29 +0000
commit30b94862648cdbf4f537337d2e2f01c369a9dee9 (patch)
treef0219dd8bd744fc09899bd0266402e05a4bff854 /system
parentImported Upstream version 1.0.0 (diff)
downloadnetdata-30b94862648cdbf4f537337d2e2f01c369a9dee9.tar.xz
netdata-30b94862648cdbf4f537337d2e2f01c369a9dee9.zip
Imported Upstream version 1.1.0upstream/1.1.0
Diffstat (limited to 'system')
-rw-r--r--system/Makefile.am29
-rw-r--r--system/Makefile.in470
-rwxr-xr-xsystem/netdata-init-d.in57
-rwxr-xr-xsystem/netdata-openrc125
-rwxr-xr-xsystem/netdata-openrc.in84
-rw-r--r--system/netdata.conf11
-rw-r--r--system/netdata.logrotate.in15
-rw-r--r--system/netdata.service.in (renamed from system/netdata-systemd)6
8 files changed, 669 insertions, 128 deletions
diff --git a/system/Makefile.am b/system/Makefile.am
new file mode 100644
index 000000000..f16a720e2
--- /dev/null
+++ b/system/Makefile.am
@@ -0,0 +1,29 @@
+#
+# Copyright (C) 2015 Alon Bar-Lev <alon.barlev@gmail.com>
+#
+MAINTAINERCLEANFILES= $(srcdir)/Makefile.in
+CLEANFILES = \
+ netdata-openrc \
+ netdata.logrotate \
+ netdata.service \
+ netdata-init-d \
+ $(NULL)
+
+include $(top_srcdir)/build/subst.inc
+
+SUFFIXES = .in
+
+nodist_noinst_DATA = \
+ netdata-openrc \
+ netdata.logrotate \
+ netdata.service \
+ netdata-init-d \
+ $(NULL)
+
+dist_noinst_DATA = \
+ netdata-openrc.in \
+ netdata.logrotate.in \
+ netdata.service.in \
+ netdata-init-d.in \
+ netdata.conf \
+ $(NULL)
diff --git a/system/Makefile.in b/system/Makefile.in
new file mode 100644
index 000000000..b5acce0ba
--- /dev/null
+++ b/system/Makefile.in
@@ -0,0 +1,470 @@
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(top_srcdir)/build/subst.inc $(srcdir)/Makefile.in \
+ $(srcdir)/Makefile.am $(dist_noinst_DATA)
+subdir = system
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+DATA = $(dist_noinst_DATA) $(nodist_noinst_DATA)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBMNL_CFLAGS = @LIBMNL_CFLAGS@
+LIBMNL_LIBS = @LIBMNL_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MATH_CFLAGS = @MATH_CFLAGS@
+MATH_LIBS = @MATH_LIBS@
+MKDIR_P = @MKDIR_P@
+NFACCT_CFLAGS = @NFACCT_CFLAGS@
+NFACCT_LIBS = @NFACCT_LIBS@
+OBJEXT = @OBJEXT@
+OPTIONAL_MATH_CLFAGS = @OPTIONAL_MATH_CLFAGS@
+OPTIONAL_MATH_LIBS = @OPTIONAL_MATH_LIBS@
+OPTIONAL_NFACCT_CLFAGS = @OPTIONAL_NFACCT_CLFAGS@
+OPTIONAL_NFACCT_LIBS = @OPTIONAL_NFACCT_LIBS@
+OPTIONAL_ZLIB_CLFAGS = @OPTIONAL_ZLIB_CLFAGS@
+OPTIONAL_ZLIB_LIBS = @OPTIONAL_ZLIB_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_RPM_RELEASE = @PACKAGE_RPM_RELEASE@
+PACKAGE_RPM_VERSION = @PACKAGE_RPM_VERSION@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ZLIB_CFLAGS = @ZLIB_CFLAGS@
+ZLIB_LIBS = @ZLIB_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+cachedir = @cachedir@
+chartsdir = @chartsdir@
+configdir = @configdir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+nodedir = @nodedir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pluginsdir = @pluginsdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+webdir = @webdir@
+
+#
+# Copyright (C) 2015 Alon Bar-Lev <alon.barlev@gmail.com>
+#
+MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
+CLEANFILES = \
+ netdata-openrc \
+ netdata.logrotate \
+ netdata.service \
+ netdata-init-d \
+ $(NULL)
+
+SUFFIXES = .in
+nodist_noinst_DATA = \
+ netdata-openrc \
+ netdata.logrotate \
+ netdata.service \
+ netdata-init-d \
+ $(NULL)
+
+dist_noinst_DATA = \
+ netdata-openrc.in \
+ netdata.logrotate.in \
+ netdata.service.in \
+ netdata-init-d.in \
+ netdata.conf \
+ $(NULL)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .in
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/build/subst.inc $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu system/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu system/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+$(top_srcdir)/build/subst.inc:
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+tags TAGS:
+
+ctags CTAGS:
+
+cscope cscopelist:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic cscopelist-am \
+ ctags-am distclean distclean-generic distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
+ pdf-am ps ps-am tags-am uninstall uninstall-am
+
+.in:
+ if sed \
+ -e 's#[@]localstatedir_POST@#$(localstatedir)#g' \
+ -e 's#[@]sbindir_POST@#$(sbindir)#g' \
+ -e 's#[@]sysconfdir_POST@#$(sysconfdir)#g' \
+ $< > $@.tmp; then \
+ mv "$@.tmp" "$@"; \
+ else \
+ rm -f "$@.tmp"; \
+ false; \
+ fi
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/system/netdata-init-d.in b/system/netdata-init-d.in
new file mode 100755
index 000000000..c317d1021
--- /dev/null
+++ b/system/netdata-init-d.in
@@ -0,0 +1,57 @@
+#!/bin/bash
+# chkconfig: 345 99 01
+# description: startup script
+
+# Source functions
+. /etc/rc.d/init.d/functions
+
+DAEMON="netdata"
+DAEMON_PATH=@sbindir_POST@
+PIDFILE=@localstatedir_POST@/$DAEMON.pid
+DAEMONOPTS="-pidfile $PIDFILE"
+STOP_TIMEOUT="10"
+
+service_start()
+{
+ echo "Starting $DAEMON..."
+ daemon $DAEMON_PATH/$DAEMON $DAEMONOPTS
+ RETVAL=$?
+ echo
+ return $RETVAL
+}
+
+service_stop()
+{
+ printf "%-50s" "Stopping $DAEMON..."
+ killproc -p ${PIDFILE} -d ${STOP_TIMEOUT} $DAEMON
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ]; then
+ rm -f ${PIDFILE}
+ fi
+ echo
+ return $RETVAL
+}
+
+service_status()
+{
+ status -p ${PIDFILE} $DAEMON_PATH/$DAEMON
+}
+
+case "$1" in
+start)
+ service_start
+;;
+status)
+ service_status
+;;
+stop)
+ service_stop
+;;
+restart)
+ service_stop
+ service_start
+;;
+*)
+ echo "Usage: $0 {status|start|stop|restart}"
+ exit 1
+esac
diff --git a/system/netdata-openrc b/system/netdata-openrc
deleted file mode 100755
index 202db64c0..000000000
--- a/system/netdata-openrc
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/sbin/runscript
-
-# The path netdata has been installed.
-# Leave it empty if netdata is installed in /
-NETDATA_INSTALL_PATH=${NETDATA_INSTALL_PATH-}
-
-# The user netdata is configured to run as.
-# If you edit its configuration file to set a different
-# user, set it here too, to have its files switch ownership
-NETDATA_OWNER=${NETDATA_OWNER-netdata:netdata}
-
-# The URL to download netdata config.
-NETDATA_CONFIG_URL=${NETDATA_CONFIG_URL-http://localhost:19999/netdata.conf}
-
-# The timeout in seconds to wait for netdata
-# to save its database on disk and exit.
-NETDATA_WAIT_EXIT_TIMEOUT=${NETDATA_WAIT_EXIT_TIMEOUT-15}
-
-# When set to 1, if netdata does not exit in
-# NETDATA_WAIT_EXIT_TIMEOUT, we will force it
-# to exit.
-NETDATA_FORCE_EXIT=${NETDATA_FORCE_EXIT-0}
-
-# Netdata will use these services, only if they
-# are enabled to start.
-NETDATA_START_AFTER_SERVICES="${NETDATA_START_AFTER_SERVICES-apache2 squid nginx mysql named opensips upsd hostapd postfix lm_sensors}"
-
-extra_started_commands="getconf"
-pidfile="/var/run/netdata/netdata.pid"
-command="${NETDATA_INSTALL_PATH}/usr/sbin/netdata"
-command_background="yes"
-
-depend() {
- use logger
- need net
-
- local x
- for x in ${NETDATA_START_AFTER_SERVICES}
- do
- if [ -f /etc/runlevels/default/${x} ]
- then
- use ${x}
- fi
- done
-}
-
-start() {
- local ret
-
- if [ ! -d ${NETDATA_INSTALL_PATH}/var/cache/netdata ]
- then
- ebegin "Creating ${NETDATA_INSTALL_PATH}/var/cache/netdata"
- mkdir -p ${NETDATA_INSTALL_PATH}/var/cache/netdata
- chown ${NETDATA_OWNER} ${NETDATA_INSTALL_PATH}/var/cache/netdata
- echo "${NETDATA_OWNER}" >${NETDATA_INSTALL_PATH}/var/cache/netdata/.last_owner
- eend $?
- fi
-
- if [ "$(cat ${NETDATA_INSTALL_PATH}/var/cache/netdata/.last_owner 2>/dev/null)" != "${NETDATA_OWNER}" ]
- then
- ebegin "Switching ownership of ${NETDATA_INSTALL_PATH}/var/cache/netdata"
- chown -R ${NETDATA_OWNER} ${NETDATA_INSTALL_PATH}/var/cache/netdata
- echo "${NETDATA_OWNER}" >${NETDATA_INSTALL_PATH}/var/cache/netdata/.last_owner
- eend 0
- fi
-
- ebegin "Starting netdata"
- start-stop-daemon --start --quiet --pidfile ${pidfile} --exec ${command} -- ${NETDATA_EXTRA_ARGS}
- ret=$?
- eend $ret
-
- if [ $ret -eq 0 -a ! -f ${NETDATA_INSTALL_PATH}/etc/netdata/netdata.conf ]
- then
- ebegin "Downloading default configuration to ${NETDATA_INSTALL_PATH}/etc/netdata/netdata.conf"
- sleep 2
- curl -s -o ${NETDATA_INSTALL_PATH}/etc/netdata/netdata.conf.new "${NETDATA_CONFIG_URL}"
- ret=$?
- if [ $ret -eq 0 -a -s ${NETDATA_INSTALL_PATH}/etc/netdata/netdata.conf.new ]
- then
- mv ${NETDATA_INSTALL_PATH}/etc/netdata/netdata.conf.new ${NETDATA_INSTALL_PATH}/etc/netdata/netdata.conf
- else
- ret=1
- rm ${NETDATA_INSTALL_PATH}/etc/netdata/netdata.conf.new 2>/dev/null
- fi
- eend $ret
- fi
-}
-
-stop() {
- local result ret=0 count=0 sigkill=0
-
- ebegin "Stopping netdata"
- start-stop-daemon --stop --quiet --pidfile ${pidfile}
- result=$?
- eend $result
-
- ebegin "Waiting for netdata to save its database"
- while [ -f "${pidfile}" ]
- do
- if [ $count -gt ${NETDATA_WAIT_EXIT_TIMEOUT} ]
- then
- sigkill=1
- break
- fi
-
- count=$[count + 1]
- kill -0 $(cat ${pidfile}) 2>/dev/null
- ret=$?
- test $ret -eq 0 && sleep 1
- done
- eend $sigkill
-
- if [ $sigkill -eq 1 -a -f "${pidfile}" ]
- then
- ebegin "Netdata is taking too long to exit, forcing it to quit"
- kill -SIGKILL $(cat ${pidfile}) 2>/dev/null
- eend $?
- fi
-}
-
-getconf() {
- ebegin "Downloading configuration from netdata to /tmp/netdata.conf"
- curl -o /tmp/netdata.conf "${NETDATA_CONFIG_URL}"
- eend $?
-}
diff --git a/system/netdata-openrc.in b/system/netdata-openrc.in
new file mode 100755
index 000000000..299db5699
--- /dev/null
+++ b/system/netdata-openrc.in
@@ -0,0 +1,84 @@
+#!/sbin/runscript
+
+# The user netdata is configured to run as.
+# If you edit its configuration file to set a different
+# user, set it here too, to have its files switch ownership
+: ${NETDATA_OWNER:=netdata:netdata}
+
+# The URL to download netdata config.
+: ${NETDATA_CONFIG_URL:=http://localhost:19999/netdata.conf}
+
+# The timeout in seconds to wait for netdata
+# to save its database on disk and exit.
+: ${NETDATA_WAIT_EXIT_TIMEOUT:=15}
+
+# When set to 1, if netdata does not exit in
+# NETDATA_WAIT_EXIT_TIMEOUT, we will force it
+# to exit.
+: ${NETDATA_FORCE_EXIT:=0}
+
+# Netdata will use these services, only if they
+# are enabled to start.
+: ${NETDATA_START_AFTER_SERVICES:=apache2 squid nginx mysql named opensips upsd hostapd postfix lm_sensors}
+
+extra_started_commands="getconf"
+pidfile="/run/netdata.pid"
+command="${NETDATA_INSTALL_PATH}/usr/sbin/netdata"
+command_background="yes"
+command_args="-pidfile ${pidfile} ${NETDATA_EXTRA_ARGS}"
+# start_stop_daemon_args="-u ${NETDATA_OWNER}"
+start_stop_daemon_args=""
+
+depend() {
+ use logger
+ need net
+ after ${NETDATA_START_AFTER_SERVICES}
+
+ checkpath -o ${NETDATA_OWNER} -d @localstatedir_POST@/cache/netdata /run/netdata
+}
+
+start_post() {
+ if [[ ! -f @sysconfdir_POST@/netdata/netdata.conf ]]; then
+ ebegin "Downloading default configuration to @sysconfdir_POST@/netdata/netdata.conf"
+ sleep 2
+ curl -s -o @sysconfdir_POST@/netdata/netdata.conf.new "${NETDATA_CONFIG_URL}"
+ ret=$?
+ if [[ $ret -eq 0 && -s @sysconfdir_POST@/netdata/netdata.conf.new ]]; then
+ mv @sysconfdir_POST@/netdata/netdata.conf{.new,}
+ else
+ ret=1
+ rm @sysconfdir_POST@/netdata/netdata.conf.new 2>/dev/null
+ fi
+ eend $ret
+ fi
+}
+
+stop_post() {
+ local result ret=0 count=0 sigkill=0
+
+ ebegin "Waiting for netdata to save its database"
+ while [[ -f "${pidfile}" ]]; do
+ if [[ $count -gt ${NETDATA_WAIT_EXIT_TIMEOUT} ]]; then
+ sigkill=1
+ break
+ fi
+
+ count=$[count + 1]
+ kill -0 $(cat ${pidfile}) 2>/dev/null
+ ret=$?
+ test $ret -eq 0 && sleep 1
+ done
+ eend $sigkill
+
+ if [[ $sigkill -eq 1 && -f "${pidfile}" ]]; then
+ ebegin "Netdata is taking too long to exit, forcing it to quit"
+ kill -SIGKILL $(cat ${pidfile}) 2>/dev/null
+ eend $?
+ fi
+}
+
+getconf() {
+ ebegin "Downloading configuration from netdata to /tmp/netdata.conf"
+ curl -o /tmp/netdata.conf "${NETDATA_CONFIG_URL}"
+ eend $?
+}
diff --git a/system/netdata.conf b/system/netdata.conf
new file mode 100644
index 000000000..df7ea1abe
--- /dev/null
+++ b/system/netdata.conf
@@ -0,0 +1,11 @@
+# NetData Configuration
+#
+# To see defaults, grab one from your instance:
+# http://localhost:19999/netdata.conf
+
+# global netdata configuration
+
+[global]
+ run as user = netdata
+ web files owner = root
+ web files group = netdata
diff --git a/system/netdata.logrotate.in b/system/netdata.logrotate.in
new file mode 100644
index 000000000..763eb09c9
--- /dev/null
+++ b/system/netdata.logrotate.in
@@ -0,0 +1,15 @@
+@localstatedir_POST@/log/netdata/*.log {
+ daily
+ missingok
+ rotate 14
+ compress
+ delaycompress
+ notifempty
+ sharedscripts
+ postrotate
+ if service netdata status > /dev/null ; then \
+ service netdata restart > /dev/null; \
+ fi;
+ endscript
+}
+
diff --git a/system/netdata-systemd b/system/netdata.service.in
index 7033cef67..bc26cc9dc 100644
--- a/system/netdata-systemd
+++ b/system/netdata.service.in
@@ -1,5 +1,5 @@
[Unit]
-Description=netdata
+Description=Linux real time system monitoring, over the web
After=network.target httpd.service squid.service nfs-server.service mysqld.service named.service postfix.service
[Service]
@@ -7,8 +7,8 @@ Type=forking
WorkingDirectory=/tmp
User=root
Group=root
-PIDFile=/var/run/netdata/netdata.pid
-ExecStart=/usr/sbin/netdata
+PIDFile=@localstatedir_POST@/run/netdata.pid
+ExecStart=@sbindir_POST@/netdata -pidfile @localstatedir_POST@/run/netdata.pid
ExecStop=/bin/kill -SIGTERM $MAINPID
TimeoutStopSec=30