From 7f992fd321f8f6f6091c88d6d653656c9a612698 Mon Sep 17 00:00:00 2001
From: Ross McDonald <ross@influxdb.com>
Date: Tue, 12 Apr 2016 08:24:06 -0500
Subject: [PATCH] Changed nohup fallback command to use 'sudo -u' so that
 Telegraf doesn't run as the root user.

---
 scripts/init.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/init.sh b/scripts/init.sh
index 09a4d24b..f104813d 100755
--- a/scripts/init.sh
+++ b/scripts/init.sh
@@ -138,7 +138,7 @@ case $1 in
         if which start-stop-daemon > /dev/null 2>&1; then
             start-stop-daemon --chuid $USER:$GROUP --start --quiet --pidfile $pidfile --exec $daemon -- -pidfile $pidfile -config $config -config-directory $confdir $TELEGRAF_OPTS >>$STDOUT 2>>$STDERR &
         else
-            nohup $daemon -pidfile $pidfile -config $config -config-directory $confdir $TELEGRAF_OPTS >>$STDOUT 2>>$STDERR &
+            nohup sudo -u $USER $daemon -pidfile $pidfile -config $config -config-directory $confdir $TELEGRAF_OPTS >>$STDOUT 2>>$STDERR &
         fi
         log_success_msg "$name process was started"
         ;;
-- 
GitLab