I have three Ubuntu Upstart scripts:
browserruns an instance of firefox as an unprivileged userbrowsersstarts whenscreenis started and launchesbrowser PORT=1browser PORT=2browser PORT=3
screenstarts a Xvfb server
The chain is:
screenstarts at runlevels 2, 3, 4, 5browsersis configured tostart on started screenand tostop on stopping screen- each instance
browser PORT=?willstop on stopping browsersand will be started bybrowsers
Issue
screen starts fine but doesn't start browsers (or it does and browsers fails to start browser PORT=?).
If I sudo start browser PORT=1 everything works fine, whereas sudo start browsers doesn't even start itself.
Code
#screen.conf
env DISPLAY=:99
env USER=worker
start on runlevel [2345]
stop on runlevel [!2345]
respawn
script
su ${USER} -c "/usr/bin/Xvfb ${DISPLAY}"
end script
#browsers.conf
start on started screen
stop on runlevel [!2345] or stopping screen
respawn
expect fork #the following "start browser ..." do fork
script
start browser PORT=4242
start browser PORT=4243
start browser PORT=4244
start browser PORT=4245
end script
#browser.conf
instance $PORT
stop on runlevel [!2345]
stop on stopping browsers or stopping screen
respawn
script
su ${USER} -c "/usr/bin/firefox -no-remote -P ${PORT} --display ${DISPLAY}"
end script
UPDATE (10/21/2010): the (modified) code above now works. However, when I need to stop browsers, all the instances of browser PORT=? are correctly terminated, while ``browsers` gets stuck.
How do I solve this other issue?