Search code examples
upstartrhel6

upstart with non root user on rhel 6


How do I start upstart script as non root user in rhel 6. I tried following options and it didn't worked.

exec start-stop-daemon --start --quiet --chuid mongodb --exec $command //This works only on ubuntu

exec setuid $uid -c $command // Didn't work

exec --run-as-user $user $command // Didn't work

Solution

  • exec su -c $command $user
    

    The above command worked for me. This might be helpful for others hence posting the answer.