[Nagiosplug-devel] Timeouts in BASH Plugins

Richard Edward Horner rich at richhorner.com
Fri Aug 29 18:27:22 CEST 2008


Babar,

Thanks for the response. I wasn't able to make any headway on this.
I'll guess I'll just rewrite my checks in Perl.

Thanks, Rich(ard)

On Thu, Aug 28, 2008 at 1:11 PM, Olivier 'Babar' Raginel
<nagios at babar.us> wrote:
> On Thu, Aug 28, 2008 at 11:55:21AM -0400, Richard Edward Horner wrote:
>>       ( sleep $TIMELIMIT; if [ `pgrep -U $USER -f "$SCRIPT" | grep -c ^$$$`
>> -gt 0 ] ; then kill -USR1 $$ ; fi; ) &
>
>
> Did you try to simply "nohup" it, so something like:
>
> ( exec >/dev/null;exec 2>&1;exec <&1;sleep $TIMELIMIT; if ...
>
>> So, my questions are:
>>
>> 1) Is this no-backgrounding thing an NRPE thing or is it some BASH
>> thing that's occurring because there's already no controlling terminal
>> or ???
>>
>> 2) Can this be made to work in BASH or do I need to use C or Perl
>> (both of which I know, just not nearly as well as I know BASH)?
>
> Because I'd think NRPE waits for the tty to be freed, and your
> background process locks it.
> Or play with huponexit, but I'm not sure it will work here.
>
> By the way, it works exactly like that in ssh:
> $ ssh some.host "(sleep 6)&date"
> Takes 6 seconds after date.
> $ ssh babar.us "(exec >/dev/null;exec 2>&1;exec <&1;sleep 6)&date"
> Returns after date
>
> --
> Babar.
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________________
> Nagios Plugin Development Mailing List Nagiosplug-devel at lists.sourceforge.net
> Unsubscribe at https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel
> ::: Please include plugins version (-v) and OS when reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null
>



-- 
Richard Edward Horner
Engineer / Composer / Electric Guitar Virtuoso
http://richhorner.com




More information about the Devel mailing list