summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2018-01-20 18:14:52 +0200
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2018-01-20 18:14:52 +0200
commit3827569c309284df52f5c75e48d78affdff2f0c0 (patch)
tree62bf23f63c20bebe9be889b511a632debb9f7df1
parent67d4998cca7ee3015ba90f0e2c1d35fd05d92f9c (diff)
added freebsd init file
-rw-r--r--installer/functions.sh8
-rw-r--r--system/Makefile.am3
-rw-r--r--system/netdata-freebsd.in46
3 files changed, 56 insertions, 1 deletions
diff --git a/installer/functions.sh b/installer/functions.sh
index 2eeb92c8fc..5116daaef8 100644
--- a/installer/functions.sh
+++ b/installer/functions.sh
@@ -502,9 +502,15 @@ NETDATA_START_CMD="netdata"
NETDATA_STOP_CMD="killall netdata"
install_netdata_service() {
+ local uname="$(uname 2>/dev/null)"
+
if [ "${UID}" -eq 0 ]
then
- if issystemd
+ if [ "${uname}" = "FreeBSD" ]
+ then
+ run cp system/netdata-freebsd /etc/rc.d/netdata && \
+ return 0
+ elif issystemd
then
# systemd is running on this system
NETDATA_START_CMD="systemctl start netdata"
diff --git a/system/Makefile.am b/system/Makefile.am
index b2e49c5af0..255147bad5 100644
--- a/system/Makefile.am
+++ b/system/Makefile.am
@@ -8,6 +8,7 @@ CLEANFILES = \
netdata.service \
netdata-init-d \
netdata-lsb \
+ netdata-freebsd \
$(NULL)
include $(top_srcdir)/build/subst.inc
@@ -20,6 +21,7 @@ nodist_noinst_DATA = \
netdata.service \
netdata-init-d \
netdata-lsb \
+ netdata-freebsd \
$(NULL)
dist_noinst_DATA = \
@@ -28,5 +30,6 @@ dist_noinst_DATA = \
netdata.service.in \
netdata-init-d.in \
netdata-lsb.in \
+ netdata-freebsd.in \
netdata.conf \
$(NULL)
diff --git a/system/netdata-freebsd.in b/system/netdata-freebsd.in
new file mode 100644
index 0000000000..13bc767b2e
--- /dev/null
+++ b/system/netdata-freebsd.in
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+. /etc/rc.subr
+
+name=netdata
+rcvar=netdata_enable
+
+pidfile="@localstatedir_POST@/run/netdata.pid"
+
+command="@sbindir_POST@/netdata"
+command_args="-P ${pidfile}"
+
+required_files="@sysconfdir_POST@/netdata/netdata.conf"
+
+start_precmd="netdata_prestart"
+stop_postcmd="netdata_poststop"
+
+extra_commands="reloadhealth savedb"
+
+reloadhealth_cmd="netdata_reloadhealth"
+savedb_cmd="netdata_savedb"
+
+netdata_prestart()
+{
+ return 0
+}
+
+netdata_poststop()
+{
+ return 0
+}
+
+netdata_reloadhealth()
+{
+ kill -USR2 `cat ${pidfile}`
+ return 0
+}
+
+netdata_savedb()
+{
+ kill -USR1 `cat ${pidfile}`
+ return 0
+}
+
+load_rc_config $name
+run_rc_command "$1"