summarylogtreecommitdiffstats
path: root/newrelic-sysmond.service
diff options
context:
space:
mode:
authorChris Severance2015-08-01 09:10:05 -0400
committerChris Severance2015-08-01 09:10:05 -0400
commit4fa8c845e6133712ef2c71e448cf072e0056abe9 (patch)
treed181c7b1db4a6b0606dc6056b99c715c45034557 /newrelic-sysmond.service
parentd77c11c1464c83e3205508188863e364cb8c55cf (diff)
downloadaur-4fa8c845e6133712ef2c71e448cf072e0056abe9.tar.gz
PKGBUILD improvements, run as non root
Diffstat (limited to 'newrelic-sysmond.service')
-rw-r--r--newrelic-sysmond.service27
1 files changed, 25 insertions, 2 deletions
diff --git a/newrelic-sysmond.service b/newrelic-sysmond.service
index 9def14256f1a..bb43dabc5e41 100644
--- a/newrelic-sysmond.service
+++ b/newrelic-sysmond.service
@@ -1,11 +1,34 @@
[Unit]
-Description=System monitor Services Provided by Newrelic
+Description=New Relic Servers Server Monitor (newrelic-sysmond)
After=network.target
[Service]
Type=forking
PIDFile=/run/nrsysmond.pid
-ExecStart=/usr/bin/nrsysmond -c /etc/newrelic/nrsysmond.cfg -p /run/nrsysmond.pid
+
+# https://blog.hqcodeshop.fi/archives/93-Handling-varrun-with-systemd.html
+# Run ExecStartPre with root-permissions
+# This seems easier and more reliable than tmpfiles.d
+PermissionsStartOnly=true
+ExecStartPre=/usr/bin/touch /run/nrsysmond.pid
+ExecStartPre=/usr/bin/chown NEWRELIC_USER:NEWRELIC_USER /run/nrsysmond.pid
+User=NEWRELIC_USER
+Group=NEWRELIC_USER
+
+# Run ExecStart with User
+ExecStart=/usr/bin/nrsysmond -c '/etc/newrelic/nrsysmond.cfg' -p '/run/nrsysmond.pid'
+
+# Arch Linux:
+# The user and group must be the same. Change all 4 at once. Don't pick a system defined user.
+# If you change the user and group names after installation, you should:
+# 1) userdel 'olduser' # if it's not being used for something else
+# 2) groupdel 'olduser' # if it's not being used for something else
+# 3) rm -rf '/.olduser' # if there's nothing in here of importance
+# 4) newrelic-sysmond.inst install # to create new user, group, and to chown folders
+
+# If you uninstall another New Relic package and find that the user and group have disappeared
+# simply run: newrelic-sysmond.inst install
+# or just upgrade the package
[Install]
WantedBy=multi-user.target