Trying to write an upstart script for a newrelic agent

Steve Langasek steve.langasek at ubuntu.com
Mon Feb 17 23:19:41 UTC 2014


Hi Mariano,

On Mon, Feb 17, 2014 at 11:43:16AM -0300, Mariano González wrote:
> Hi guys.
> I'm asking for help to write a script to monitor a newrelic agent.
> Here's what I have now: https://gist.github.com/marianogg9/9002995
> As you may see, the service won't start and will respawn 10 times. I think
> this is an env issue, but I tried with export and env stanzas without
> success.
> Any comments will be really appreciated.
> Thanks!

Your upstart job does:

  exec sudo -u root 'bundle exec /path_to_plugin/newrelic/newrelic_rs_dfw/bin/newrelic_rs' 

The obvious issue here is that this is the wrong syntax.  Quoting the string
'bundle exec [...]' causes sudo to try to find a program named 'bundle exec
[...]', instead of executing the program 'bundle' with arguments 'exec',
[...].

Note that it's recommended to not use sudo for upstart jobs, in general, as
sudo spawns an associated PAM session which is normally not what you want.
And if all you care about is the user id, then 'sudo -u root' is redundant
since all system jobs run as root by default.

Finally, if you have any further problems with this job, try looking in
/var/log/upstart/newrelic.log.  Assuming you're running a new enough
upstart, you will have logs there (including the error output of your failed
sudo commands).

Hope that helps,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slangasek at ubuntu.com                                     vorlon at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/upstart-devel/attachments/20140217/81cce595/attachment.pgp>


More information about the upstart-devel mailing list