I am trying to run some Java programs under daemontools and it is
working quite well. Except they are running as root and I would like
to make them run as www-data. I found the daemontools "setuidgid"
program which works for well for starting up the application but then
daemontools cannot shut the application down again. Here is an example
of the daemontools run job -
# /etc/service/myapplication/run startup script
exec setuidgid www-data java -jar /opt/webapps/myapplication.jar
--port 9000 --headless >> /opt/logs/myapplication.log 2>&1
when I leave out the setuidgid stuff then I am able to start and stop
the application. But with the above example the shutdown signal does
not seem to reach the Java process even though I am using exec.
Any hints will be much appreciated!