Trying to write an upstart script for a newrelic agent

Mariano González gonzalez.mariano.gabriel at gmail.com
Tue Feb 18 14:51:31 UTC 2014


Heh guys. Here's the agent script:
https://gist.github.com/marianogg9/9072387, from
https://github.com/newrelic-platform/newrelic_rackspace_load_balancers_plugin

And this got my attention:

unless $:.include?(File.dirname(__FILE__) + '/../lib/')
  $: << File.dirname(__FILE__) + '/../lib'
end

Isn't it an env path definition? keep in mind you need to be pwd in
/path/newrelic_rs_dfw/ to run bundle exec bin/newrelic_rs.rb

Thanks.


On 18 February 2014 08:56, Mariano González <
gonzalez.mariano.gabriel at gmail.com> wrote:

> Hi Steve and Clint. Thanks for your comments.
>
> @Steve
>
> You're totally right, it's not necessary to write sudo -u root as it's the
> same as writing sudo. My fault there.
> But, the command to run the agent is the following:
>
> $ cd /path/newrelic_rs_dfw/
> $ bundle exec ./bin/newrelic_rs
>
> As bundle exec is a ruby gem located in /path/newrelic_rs_dfw/. So, to
> this script to function it'd need to locate in /path/newrelic_rs_dfw/ first
> and then run the bundle exec. Which it doesn't do if I write down those two
> previous steps in a script. Neither it does if I specify an env variable or
> source stanza. That's why I think this is an env issue.
>
> @Clint
>
> I'm trying to run this agent as an Upstart job, that's why I'm writing an
> /etc/init/newrelic.conf script. Sorry if I missunderstood your comments if
> it's not what you meant.
>
> Finally, there's no trace of newrelic logs in /var/log/ besides /newrelic/
> folder where OTHER newrelic agents does write their logs in this vm.
>
> The only logs I have are the ones written in /messages.log
>
> Thanks again!
>
>
> On 17 February 2014 12:40, Clint Byrum <clint at fewbar.com> wrote:
>
>> Excerpts from Mariano González's message of 2014-02-17 06:43:16 -0800:
>> > 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!
>> >
>>
>> If you are running it as root, why not have it as a system job from
>> /etc/init/something.conf ? Then you can drop sudo.
>>
>> Also you should have logs in ~/.cache/upstart if it is a user job, or
>> /var/log/upstart if it is a system job. Those should give a clue as to
>> why your command is failing.
>>
>> --
>> upstart-devel mailing list
>> upstart-devel at lists.ubuntu.com
>> Modify settings or unsubscribe at:
>> https://lists.ubuntu.com/mailman/listinfo/upstart-devel
>>
>
>
>
> --
> Mariano Gabriel González
>



-- 
Mariano Gabriel González
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/upstart-devel/attachments/20140218/312c333f/attachment-0001.html>


More information about the upstart-devel mailing list