Stupid Geek Tricks (was Re: attempt recovery on service CRITICAL with nrpe)
donavan nelson
donavan at 4wx.net
Thu Jan 23 05:25:58 CET 2003
way cool, now I'd get rid of the wc -l and use the grep -c option and you save
another fork.
.dn
--
Donavan Nelson
4wx Networks
www.4wx.net
---------- Original Message -----------
From: "Steve Bonds" <r1p6os402 at sneakemail.com>
To: nagios-users at lists.sourceforge.net
Sent: Wed, 22 Jan 2003 18:40:22 -0800 (PST)
Subject: Re: [Nagios-users] attempt recovery on service CRITICAL with nrpe
> This is probably drifting dangerously offtopic into "stupid grep
> tricks", but here's what I use:
>
> Instead of:
>
> ERS=`ps -eaf | grep ns-slapd | grep -v "grep" | wc -l`
>
> use:
>
> ERS=`ps -eaf | grep [n]s-slapd | wc -l`
>
> The [] is normally used to match one of many chars. In this case it
> only matches one. The "[n]" literal shows up in the process list on
> the grep command. However, [n] evaluated by grep down to become "n"
> does not match the "[n]" it sees in the process list so your grep
> won't show up.
>
> It'll make more sense if you just try it. ;-)
>
> -- Steve
>
> On Wed, 22 Jan 2003, Jamin jragle-at-unm.edu |Nagios| wrote:
>
> > It does not matter the order in this case.
> > Test it out. As long as the grep is striped out before you do the word
> > count, you are cool.
> >
> > -Jamin
> >
> > On Wed, 22 Jan 2003, donavan nelson wrote:
> >
> > > you have that backwards...
> > >
> > > ERS=`ps -eaf | grep -v grep | grep ns-slapd | wc -l`
> > >
> > > should be
> > > ERS=`ps -eaf | grep ns-slapd | grep -v "grep" | wc -l`
> > >
> > > the second grep "could" make an appearance.
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Scholarships for Techies!
> Can't afford IT training? All 2003 ictp students receive
> scholarships. Get hands-on training in Microsoft, Cisco, Sun,
> Linux/UNIX, and more. www.ictp.com/training/sourceforge.asp
_______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
------- End of Original Message -------
-------------------------------------------------------
This SF.net email is sponsored by: Scholarships for Techies!
Can't afford IT training? All 2003 ictp students receive scholarships.
Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more.
www.ictp.com/training/sourceforge.asp
More information about the Users
mailing list