switch user/user upstart jobs ? - su -c and expect fork

Steffen Barszus steffenbpunkt at googlemail.com
Tue May 17 20:01:59 UTC 2011


Hi !

I'm working on an upstart job starting an application as a different
user. Until now i have used su -c doing that, but started recognizing
now that upstart can not follow the pid properly like that. 

It is also recomended way in upstart cookbook. 

From my analysis i understand the following:

Lets assume i use script/end script to start in the end:

....
exec su -c "some daemon " someuser
end script 

the exec replaces the shell with the su command which itself starts a
shell which start the daemon. Now upstart can get the PID of the su
command but not of the shell it starts or even the daemon. The best one
can get is that the su shell gets killed and hope and pray that the
daemon started in the shell will die from that in time. 

So this doesnt seem to be a perfect solution. Any comments ? 

Will there be a user keyword anytime soon ? (it might do the same as su,
but if it can track the PID properly it might be worth it ?)

pre-stop, start-stop-daemon seems awkward and opposite to upstart ... 

... but might be a solution. for the time beeing. 



More information about the upstart-devel mailing list