Ubuntu – How to run a script once and only once in Upstart


I have a script that starts on desktop-session-start. The first person who logs in graphically after a boot will have this script called. I want it called once, not every time a person logs in. How do I make a script perform just once?

# one time script

start on desktop-session-start
stop on somebodystopme

end script

Best Answer

Use post-start script section instead of script section. It will leave the job as started/running state and it will not be re-run.