@cryptotaxi247 / netdata-1 / commits / 458de8ae0

build: revert pid to live within /var/run/netdata

as pid processing is non standard fixing mechanism is out of scope. fix C code to follow the autoconf location. Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>

Alon Bar-Lev committed Apr 3, 2016 at 00:08 UTC 458de8ae0d3c3da5626a30a2077a5116e09254cb
6 files changed +6 -5
netdata-installer.sh
+1 -1
@@ -314,7 +314,7 @@ do
314
315 count=$((count + 1))
316
317 - pid=$(cat /var/run/netdata.pid 2>/dev/null)
317 + pid=$(cat /var/run/netdata/netdata.pid 2>/dev/null)
318 isnetdata $pid || pid=
319 if [ ! -z "${pid}" ]
320 then
src/Makefile.am
+1
@@ -8,6 +8,7 @@ AM_CPPFLAGS = \
8 -DCONFIG_DIR="\"$(configdir)\"" \
9 -DLOG_DIR="\"$(logdir)\"" \
10 -DPLUGINS_DIR="\"$(pluginsdir)\"" \
11 + -DRUN_DIR="\"$(localstatedir)/run/netdata\"" \
12 -DWEB_DIR="\"$(webdir)\"" \
13 $(NULL)
14 AM_CFLAGS = \
src/daemon.c
+1 -1
@@ -71,7 +71,7 @@ void sig_handler(int signo)
71 }
72 }
73
74 -char rundir[FILENAME_MAX + 1] = "/var/run/netdata";
74 +char rundir[FILENAME_MAX + 1] = RUN_DIR;
75 char pidfile[FILENAME_MAX + 1] = "";
76 void prepare_rundir() {
77 if(getuid() != 0) {
src/main.c
+1 -1
@@ -44,7 +44,7 @@ void netdata_cleanup_and_exit(int ret)
44 netdata_exit = 1;
45 rrdset_save_all();
46 // kill_childs();
47 - unlink("/var/run/netdata.pid");
47 + unlink(RUN_DIR "netdata.pid");
48 info("NetData exiting. Bye bye...");
49 exit(ret);
50 }
system/netdata-openrc
+1 -1
@@ -26,7 +26,7 @@ NETDATA_FORCE_EXIT=${NETDATA_FORCE_EXIT-0}
26 NETDATA_START_AFTER_SERVICES="${NETDATA_START_AFTER_SERVICES-apache2 squid nginx mysql named opensips upsd hostapd postfix lm_sensors}"
27
28 extra_started_commands="getconf"
29 -pidfile="/var/run/netdata.pid"
29 +pidfile="/var/run/netdata/netdata.pid"
30 command="${NETDATA_INSTALL_PATH}/usr/sbin/netdata"
31 command_background="yes"
32
system/netdata.service.in
+1 -1
@@ -7,7 +7,7 @@ Type=forking
7 WorkingDirectory=/tmp
8 User=root
9 Group=root
10 -PIDFile=@localstatedir_POST@/run/netdata.pid
10 +PIDFile=@localstatedir_POST@/run/netdata/netdata.pid
11 ExecStart=@sbindir_POST@/netdata
12 ExecStop=/bin/kill -SIGTERM $MAINPID
13 TimeoutStopSec=30