From 25cc327dffabb144731c58eac67abeeee1ce91e7 Mon Sep 17 00:00:00 2001 From: Nate Meyer Date: Thu, 5 Mar 2015 10:17:54 -0800 Subject: [PATCH 1/3] add a systemd service file --- etc/systemd/system/newrelic-plugin-agent.service | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 etc/systemd/system/newrelic-plugin-agent.service diff --git a/etc/systemd/system/newrelic-plugin-agent.service b/etc/systemd/system/newrelic-plugin-agent.service new file mode 100644 index 0000000..4c3eacb --- /dev/null +++ b/etc/systemd/system/newrelic-plugin-agent.service @@ -0,0 +1,12 @@ +[Unit] +Description=newrelic-plugin-agent + +[Service] +Type=forking +User=newrelic +PIDFile=/var/run/newrelic/newrelic-plugin-agent.pid +ExecStart=/usr/bin/newrelic-plugin-agent -c /etc/newrelic/newrelic-plugin-agent.cfg +ExecStop=/bin/kill -INT $MAINPID + +[Install] +WantedBy=multi-user.target \ No newline at end of file From 983e4ada626edf0d1173b3eb64c8f4d2b571c5b8 Mon Sep 17 00:00:00 2001 From: Nate Meyer Date: Thu, 5 Mar 2015 10:22:47 -0800 Subject: [PATCH 2/3] \n at the end --- etc/systemd/system/newrelic-plugin-agent.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/systemd/system/newrelic-plugin-agent.service b/etc/systemd/system/newrelic-plugin-agent.service index 4c3eacb..5b73978 100644 --- a/etc/systemd/system/newrelic-plugin-agent.service +++ b/etc/systemd/system/newrelic-plugin-agent.service @@ -9,4 +9,4 @@ ExecStart=/usr/bin/newrelic-plugin-agent -c /etc/newrelic/newrelic-plugin-agent. ExecStop=/bin/kill -INT $MAINPID [Install] -WantedBy=multi-user.target \ No newline at end of file +WantedBy=multi-user.target From 71029180d4e12af3a5ca3731ba0a6246645074a5 Mon Sep 17 00:00:00 2001 From: Richard Bullington-McGuire Date: Tue, 2 Jun 2015 19:39:29 -0400 Subject: [PATCH 3/3] Use more robust systemd startup settings --- etc/systemd/system/newrelic-plugin-agent.service | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/etc/systemd/system/newrelic-plugin-agent.service b/etc/systemd/system/newrelic-plugin-agent.service index 5b73978..bf6e2b7 100644 --- a/etc/systemd/system/newrelic-plugin-agent.service +++ b/etc/systemd/system/newrelic-plugin-agent.service @@ -3,10 +3,18 @@ Description=newrelic-plugin-agent [Service] Type=forking +PrivateTmp=yes User=newrelic +Group=newrelic +PermissionsStartOnly=true PIDFile=/var/run/newrelic/newrelic-plugin-agent.pid +ExecStartPre=/bin/mkdir -p /var/run/newrelic +ExecStartPre=/bin/rm -f /var/run/newrelic/newrelic-plugin-agent.pid +ExecStartPre=/bin/chown -R newrelic:newrelic /var/run/newrelic ExecStart=/usr/bin/newrelic-plugin-agent -c /etc/newrelic/newrelic-plugin-agent.cfg ExecStop=/bin/kill -INT $MAINPID +Restart=on-abort [Install] WantedBy=multi-user.target +