<div dir="ltr">Hi Daniel,<div class="gmail_extra"><br><div class="gmail_quote">2014-07-28 3:01 GMT+01:00 Daniel Lam <span dir="ltr"><<a href="mailto:daniel.cklam@gmail.com" target="_blank">daniel.cklam@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi there, <div><br></div><div>Need some help in using upstart in an Amazon-Linux-AMI instance here. My apology if this is not the right place to ask.. but IRC channel says "post to mailing list if no response here".</div>

<div><br></div><div>I've got my .conf below placed in /etc/init. Command to start/stop/restart would work, e.g. "sudo start my-app-name". However I can't get my process to start automatically on reboot (see how I tried 2 different params already).</div>

<div><br></div><div><br></div><div><p style="margin:0px;font-size:11px;font-family:Monaco">    #!upstart<span style="font-family:arial;font-size:small"> </span></p></div></div></blockquote><div>I'm guessing this is just a reminder to yourself that this is an upstart job since there is no hash-bang magic for upstart :-)</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>
<p style="margin:0px;font-size:11px;font-family:Monaco">    description "node app"</p>
<p style="margin:0px;font-size:11px;font-family:Monaco;min-height:15px">    </p>
<p style="margin:0px;font-size:11px;font-family:Monaco">    #start on started mountall</p>
<p style="margin:0px;font-size:11px;font-family:Monaco">    start on startup</p></div></div></blockquote><div>This is the most likely cause of the issue you are seeing. Read <a href="http://upstart.ubuntu.com/cookbook/#normal-start">http://upstart.ubuntu.com/cookbook/#normal-start</a> (use the runlevel version). As documented in upstart-events(7) and startup(7), the startup event is emitted very early in boot - before disks are writeable, etc. Use 'start on runlevel [2345]. If you have particular requirements for starting as early as possible, I suggest you read upstart-events(7) carefully since this documents all "well-known" events along with the order in which they are emitted.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>
<p style="margin:0px;font-size:11px;font-family:Monaco">    stop on shutdown</p></div></div></blockquote><div>(Unless you have arranged to have this event emitted) this is incorrect - see <a href="http://upstart.ubuntu.com/cookbook/#normal-shutdown">http://upstart.ubuntu.com/cookbook/#normal-shutdown</a>.</div>
<div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>
<p style="margin:0px;font-size:11px;font-family:Monaco;min-height:15px">    </p>
<p style="margin:0px;font-size:11px;font-family:Monaco">    # Automatically Respawn:</p>
<p style="margin:0px;font-size:11px;font-family:Monaco">    respawn</p>
<p style="margin:0px;font-size:11px;font-family:Monaco">    respawn limit 99 5</p></div></div></blockquote><div>See the extremely important note that starts this section - <a href="http://upstart.ubuntu.com/cookbook/#respawn">http://upstart.ubuntu.com/cookbook/#respawn</a> </div>
<div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>
<p style="margin:0px;font-size:11px;font-family:Monaco;min-height:15px">    </p>
<p style="margin:0px;font-size:11px;font-family:Monaco">    env NODE_ENV=development</p>
<p style="margin:0px;font-size:11px;font-family:Monaco;min-height:15px">    </p>
<p style="margin:0px;font-size:11px;font-family:Monaco">    script</p>
<p style="margin:0px;font-size:11px;font-family:Monaco">        cd /home/ec2-user/test</p></div></div></blockquote><div>Best to use the chdir stanza:  <a href="http://upstart.ubuntu.com/cookbook/#chdir">http://upstart.ubuntu.com/cookbook/#chdir</a>. Note that this service will be running as root. Maybe you want to run as ec2-user instead? See:</div>
<div><br></div><div><a href="http://upstart.ubuntu.com/cookbook/#setuid">http://upstart.ubuntu.com/cookbook/#setuid</a><br></div><div><a href="http://upstart.ubuntu.com/cookbook/#setgid">http://upstart.ubuntu.com/cookbook/#setgid</a><br>
</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>
<p style="margin:0px;font-size:11px;font-family:Monaco">        exec node app.js 2>&1 >> /var/log/test.log</p></div></div></blockquote><div>Redirection most likely not necessary since as of Upstart 1.4, all job output is logged automatically to /var/log/upstart/$job.log. To determine which version of Upstart you are using, run "initctl version". This coupled to the fact you were starting the job 'on startup' likely meant that app.js was failing to start (due to disks not being writeable), but it also wasn't able to log any errors for the same reason.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>
<p style="margin:0px;font-size:11px;font-family:Monaco">    end script</p>
<p style="margin:0px;font-size:11px;font-family:Monaco;min-height:15px">    </p></div><div>Any help will be much appreciated thank you!</div><span class=""><font color="#888888"><div><br></div><div>Daniel</div><div> </div>
</font></span></div>
<br>--<br>
upstart-devel mailing list<br>
<a href="mailto:upstart-devel@lists.ubuntu.com">upstart-devel@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/upstart-devel" target="_blank">https://lists.ubuntu.com/mailman/listinfo/upstart-devel</a><br>
<br></blockquote></div><br><div> <br></div><div dir="ltr">Kind regards,<br><br>James.<br>--<br>James Hunt<br>____________________________________<br>#upstart on freenode<br><a href="http://upstart.ubuntu.com/cookbook" target="_blank">http://upstart.ubuntu.com/cookbook</a><br>
<a href="https://lists.ubuntu.com/mailman/listinfo/upstart-devel" target="_blank">https://lists.ubuntu.com/mailman/listinfo/upstart-devel</a><br></div>
</div></div>