The only reason I have come up with to use start-stop-daemon is if the pre-start or post-stop sections need to be run as root, but the main process needs another user. Example here:
# Create directory with the daemon's user (need to run this as root)
pre-start exec install -o _foo -g _foo -d /run/foo
# Use start-stop-daemon to run the daemon as another user and group
exec start-stop-daemon -S -q -c _foo:_foo -x /usr/sbin/foo -- {args}
The setuid
and setgid
stanzas will not work in this situation because the pre-start process will have the unpriveleged user and will not be able to create /run/foo
.
Other than that, just use exec
.