I often see some upstart script has the to use exec
, what is the point? Seems removing the exec the script also work?
e.g.
start on runlevel [2345]
stop on runlevel [06]
exec /path/to/program
If you remove exec
, then the startup script will continue running, waiting until the started utility terminates. E.g. inefficient and wastes extra RAM and other resources (unless you want to monitor some kind of abnormal termination, and restart the utility again)
With exec
, instead of waiting for the started utility to terminate, the utility starts in place of an existing script.
THere is a shell reading that script:
/path/to/program
: will have the shell launch 'program' as a subcommand
exec /path/to/program
: will replace the shell with 'program' (saving a pid, and other advantages. And it's fine : you no longer need the shell itself at that point, as there is no further things for that shell to do)