How can I log the stdout of a process started by start-stop-daemon?

To expand on ypocat’s answer, since it won’t let me comment: start-stop-daemon –start –quiet –chuid $DAEMONUSER \ –make-pidfile –pidfile $PIDFILE –background \ –startas /bin/bash — -c “exec $DAEMON $DAEMON_ARGS > /var/log/some.log 2>&1” Using exec to run the daemon allows stop to correctly stop the child process instead of just the bash parent. Using –startas instead … Read more

Best practice to run Linux service as a different user

On Debian we use the start-stop-daemon utility, which handles pid-files, changing the user, putting the daemon into background and much more. I’m not familiar with RedHat, but the daemon utility that you are already using (which is defined in /etc/init.d/functions, btw.) is mentioned everywhere as the equivalent to start-stop-daemon, so either it can also change … Read more