]> arthur.barton.de Git - netdata.git/commitdiff
PID file fixes (systemd, openrc)
authorpavel <pavel.github@outlook.com>
Sat, 9 Apr 2016 08:55:37 +0000 (04:55 -0400)
committerpavel <pavel.github@outlook.com>
Sat, 9 Apr 2016 08:55:37 +0000 (04:55 -0400)
src/daemon.c
system/netdata-openrc.in
system/netdata.service.in

index 2dd7b09c85ab6278e7b68b9e54fb95fec8da94ab..d091f7730216b8ae13354a599ed58ef5511e7b7e 100644 (file)
@@ -306,6 +306,7 @@ int become_daemon(int dont_fork, int close_all_files, const char *user, const ch
                        // don't close it, we might need it at exit
                        // close(pidfd);
                }
+               else error("Failed to open pidfile '%s'.", pidfile);
        }
 
        if(user && *user) {
index 06bb7ffb20dcd9e7fde31c86cddb4125ea1251af..3b747fcba149942eafd306904534ee9809f12467 100755 (executable)
@@ -36,6 +36,11 @@ depend() {
        checkpath -o ${NETDATA_OWNER} -d @localstatedir_POST@/cache/netdata /run/netdata
 }
 
+start_pre() {
+       piddir=$(dirname ${pidfile})
+       mkdir -p ${piddir}
+}
+
 start_post() {
        if [[ ! -f @sysconfdir_POST@/netdata/netdata.conf ]]; then
                ebegin "Downloading default configuration to @sysconfdir_POST@/netdata/netdata.conf"
index 6adea5d3439ace7d17283cd12e2759a4a60d0108..fc5866c5a685a6e2b73695c32d4aa0c49c1f0e9a 100644 (file)
@@ -9,7 +9,6 @@ User=root
 Group=root
 PIDFile=@localstatedir_POST@/run/netdata/netdata.pid
 ExecStartPre=/usr/bin/mkdir -p @localstatedir_POST@/run/netdata
-ExecStartPre=/usr/bin/chown -R netdata:netdata @localstatedir_POST@/run/netdata
 ExecStart=@sbindir_POST@/netdata -pidfile @localstatedir_POST@/run/netdata/netdata.pid
 ExecStop=/bin/kill -SIGTERM $MAINPID
 TimeoutStopSec=30