View Single Post
Old 08-31-2013, 07:02 PM   #14
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 4,605
Karma: 4440239
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW & PW2
@silver18: Upstart runs its script portions more or less like a shell in 'honor return codes' (-e) mode. Meaning if *any* part of the script returns a non-zero return code, the full script/job will fail. Which might possibly halts the boot process, I'm not familiar enough with upstart and the job tree on the Kindle to be definitive on that, and I don't really want to be, so I just handle it with a touch of paranoia .

In the OP's examples, that means that if the file it tries to run doesn't exist, it'll fail to start the job, possibly not very gracefully, possibly halting the boot process.

So, simple workaround, check that the file exists before running it, (and eventually return 0 at the end for extra paranoia ^^):

Code:
exec /bin/bash /var/local/dev/somescript.sh
=>

Code:
[ -f /var/local/dev/somescript.sh ] && exec /bin/bash /var/local/dev/somescript.sh
Also, on a sidenote, I have no idea if relying on 'exec' in the script potion of an upstart job is safe at all. I'd just live with the fork, and just run it relying on the shebang.
NiLuJe is online now   Reply With Quote