Replace sudo with su in init script

To avoid issues starting service when 'Defaults requiretty' is enabled in the sudoers file.

Fixes #1204
closes #1205
This commit is contained in:
Jack Tench 2016-05-16 19:43:13 +01:00 committed by Cameron Sparr
parent a59bf7246a
commit 08ecfb8a67
1 changed files with 1 additions and 1 deletions

View File

@ -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 sudo -u $USER $daemon -pidfile $pidfile -config $config -config-directory $confdir $TELEGRAF_OPTS >>$STDOUT 2>>$STDERR &
su -s /bin/sh -c "nohup $daemon -pidfile $pidfile -config $config -config-directory $confdir $TELEGRAF_OPTS >>$STDOUT 2>>$STDERR &" $USER
fi
log_success_msg "$name process was started"
;;