<div class="gmail_quote">On Sun, Mar 11, 2012 at 2:33 PM, Till Klampaeckel <span dir="ltr"><<a href="mailto:till@lagged.biz">till@lagged.biz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
I was wondering what you guys suggest to debug upstart scripts. In<br>
general, I am having trouble finding docs which are suitable for<br>
upstart on lucid. It seems like 0.6.5 is installed and most of the<br>
time the only error message received is 'unknown job'.<br></blockquote><div> <br>When doing what? On boot? When running initctl?<br><br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I've been thinking about upgrading but I couldn't find great guides,<br>
add to that updating a super daemon at instance start up seems like<br>
asking for more problems. We run all our servers on AWS currently and<br>
bootstrap the rest of the stack with chef.<br></blockquote><div> <br>It depends what you're trying to do. The version of upstart on Lucid has a few limitations, but unless you're running into one of them (such as no chroot support) then you shouldn't have to upgrade.<br>
<br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Anyway, I've tried a few things.<br>
<br>
E.g., verbose doesn't seem to work at all:<br>
$ sudo initctl -vvvvvv start gearman-worker<br>
gearman-worker start/running, process 17992<br>
<br>
(Note: the worker is not running. ;))<br></blockquote><div><br>I'm guessing the worker forks once or twice (to daemonize). Try the 'expect' stanza [1].<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I am trying this in my 'script' block:<br>
<br>
exec 2 >> /var/log/upstart-debug.log<br>
set -x<br>
<br>
But the log stays empty. I don't know what it does in there which<br>
would yield a 'successful' result.<br></blockquote><div> <br>It's possible that that part of the filesystem isn't writable when the job runs (if this is a job that starts on boot). Try the lines suggested in [2]. There are other lots of other debugging suggestions in that section [3] as well, but not all of them will apply to the version in Lucid.<br>
<br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
My second problem is:<br>
<br>
I wanted to distribute the gearman-worker.conf with the worker code<br>
and created a symlink from /etc/init/gearman-worker.conf to my<br>
application checkout - upstart fails with 'unknown job' and strace<br>
tells me it thinks 'resource not available'.<span class="HOEnZb"><font color="#888888"><br>
</font></span></blockquote></div><br>Symbolic links are not permitted in /etc/init/ [4]. If the checkout is on the same filesystem, use hard links instead.<br><br>If you have any more questions, the answer is probably in the cookbook [5].<br>
<br>Hope this helps,<br>Evan<br><br>[1] <a href="http://upstart.ubuntu.com/cookbook/#expect">http://upstart.ubuntu.com/cookbook/#expect</a><br>[2] <a href="http://upstart.ubuntu.com/cookbook/#obtaining-a-log-of-a-script-section">http://upstart.ubuntu.com/cookbook/#obtaining-a-log-of-a-script-section</a><br>
[3] <a href="http://upstart.ubuntu.com/cookbook/#debugging">http://upstart.ubuntu.com/cookbook/#debugging</a><br>[4] <a href="http://upstart.ubuntu.com/cookbook/#symbolic-links-don-t-work-in-etc-init">http://upstart.ubuntu.com/cookbook/#symbolic-links-don-t-work-in-etc-init</a><br>
[5] <a href="http://upstart.ubuntu.com/cookbook/">http://upstart.ubuntu.com/cookbook/</a><br>