summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlon Bar-Lev <alon.barlev@gmail.com>2016-04-02 19:58:05 +0300
committerAlon Bar-Lev <alon.barlev@gmail.com>2016-04-02 23:07:47 +0300
commit1e40bc2dca82c794b1ef9473fa0d027f94014cb7 (patch)
treeb5c9302d1c86227ede9e9579ebdcb062e4250e00
parent4c85e7362dc3f4ec875e711fbf255f186c9085ed (diff)
build: generate proper systemd service file
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
-rw-r--r--.gitignore1
-rw-r--r--build/subst.inc10
-rw-r--r--system/Makefile.am13
-rw-r--r--system/netdata.service.in (renamed from system/netdata.service)4
4 files changed, 25 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index a12232743f..e6f03c7ad5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -48,6 +48,7 @@ src/.project
src/.settings/
src/TODO.txt
src/rrddim_file.c
+system/netdata.service
valgrind.log
valgrind2.log
web/chart-info/
diff --git a/build/subst.inc b/build/subst.inc
new file mode 100644
index 0000000000..18743abb72
--- /dev/null
+++ b/build/subst.inc
@@ -0,0 +1,10 @@
+.in:
+ if sed \
+ -e 's#[@]localstatedir_POST@#$(localstatedir)#g' \
+ -e 's#[@]sbindir_POST@#$(sbindir)#g' \
+ $< > $@.tmp; then \
+ mv "$@.tmp" "$@"; \
+ else \
+ rm -f "$@.tmp"; \
+ false; \
+ fi
diff --git a/system/Makefile.am b/system/Makefile.am
index d52fbddeb7..88da5341a1 100644
--- a/system/Makefile.am
+++ b/system/Makefile.am
@@ -2,8 +2,19 @@
# Copyright (C) 2015 Alon Bar-Lev <alon.barlev@gmail.com>
#
MAINTAINERCLEANFILES= $(srcdir)/Makefile.in
+CLEANFILES = \
+ netdata.service \
+ $(NULL)
+
+include $(top_srcdir)/build/subst.inc
+
+SUFFIXES = .in
+
+nodist_noinst_DATA = \
+ netdata.service \
+ $(NULL)
dist_noinst_DATA = \
netdata-openrc \
- netdata.service \
+ netdata.service.in \
$(NULL)
diff --git a/system/netdata.service b/system/netdata.service.in
index 20a775b525..094670ffc3 100644
--- a/system/netdata.service
+++ b/system/netdata.service.in
@@ -7,8 +7,8 @@ Type=forking
WorkingDirectory=/tmp
User=root
Group=root
-PIDFile=/var/run/netdata.pid
-ExecStart=/usr/sbin/netdata
+PIDFile=@localstatedir_POST@/run/netdata.pid
+ExecStart=@sbindir_POST@/netdata
ExecStop=/bin/kill -SIGTERM $MAINPID
TimeoutStopSec=30