Differences between script and exec

Asked by Ankur Oberoi on 2012-04-10

I'm wondering what exactly the differences and similarities are between three different patterns I've seen in upstart scripts in the wild. Here are the patterns:

#------------------- 1 -------------------------
description "node program that just has an exec stanza"
author "ankur"

respawn
respawn limit 99 5

exec /usr/local/bin/node /home/ubuntu/server.js

#------------------- 2 -------------------------
description "node program that just has an script stanza"
author "ankur"

respawn
respawn limit 99 5

script
        /usr/local/bin/node /home/ubuntu/server.js
end script

#------------------- 3 -------------------------
description "node program that has script and exec stanzas"
author "ankur"

respawn
respawn limit 99 5

script
        exec /usr/local/bin/node /home/ubuntu/server.js
end script

From my own investigation, I couldn't spot any differences. Namely, on 'start' they all get a pid, if I try to start when its already running I'm told that its already running, 'stop' works as expected. If the program exits, they all try to respawn.

If these are all equivalent, then what is the point of exec inside a script stanza? If not, how do these behave differently. I'm not that familiar with how shells are used to start processes and when a new shell process is created, so any explanation of those types of conditions would be great. Also, when would one of these by the right/wrong choice for any given program?

Thanks!

Question information

Language:
English Edit question
Status:
Expired
For:
upstart Edit question
Assignee:
No assignee Edit question
Last query:
2012-04-25
Last reply:
2012-05-11
Launchpad Janitor (janitor) said : #1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Ankur Oberoi (aoberoi) said : #2

Reopen

Sent from my iPad

On Apr 25, 2012, at 5:06 AM, Launchpad Janitor
<email address hidden> wrote:

> Your question #193139 on upstart changed:
> https://answers.launchpad.net/upstart/+question/193139
>
> Status: Open => Expired
>
> Launchpad Janitor expired the question:
> This question was expired because it remained in the 'Open' state
> without activity for the last 15 days.
>
> --
> If you're still having this problem, you can reopen your question either
> by replying to this email or by going to the following page and
> entering more information about your problem:
> https://answers.launchpad.net/upstart/+question/193139
>
> You received this question notification because you asked the question.

Launchpad Janitor (janitor) said : #3

This question was expired because it remained in the 'Open' state without activity for the last 15 days.