Scripts to start and stop

Bill Larson wllarso at swcp.com
Fri May 25 18:29:22 UTC 2001


The output from the ps command is being truncated!  I believe that
there is also a "w" option to ps which will include more of the command
argument being reported (and maybe a "ww" also!).  Take a look at the
man page for ps.

Another option could be to modify the nanny.pl command to record the
PID of the nanny command in a file, exactly the same idea as named
writing a named.pid file.  This could be done by adding the following
just prior to the being of the "for" loop:

	open(PID,"/var/run/nanny.pid");
	print PID $$;

This will give you a file, "/var/run/nanny.pid", which contains the
value of the PID of the nanny.pl script that is running.  You can
then use the value reported in this file for the PID to actually kill.

Bill Larson

> None of that was working... only thing that would show up would be the grep
> statement.
> 
> So, I did a test.  From command line I type ps -aux | grep nanny.pl
> 
> All I got back was
> grep nanny.pl
>  in ps -aux the full name is:
> /usr/bin/perl ./nanny.pl
> 
> So I did a ps -aux | grep perl
> 
> and it returns this for the nanny line
> /usr/bin/perl ./n
> 
> I do a ps -aux | grep './n'
> and it comes back with
> /usr/bin/perl ./n
> (as well as /usr/local/sbin/n for some reason)
> 
> I have no cluse what is going on.
> 
> Adam Lang
> Systems Engineer
> Rutgers Casualty Insurance Company
> http://www.rutgersinsurance.com
> ----- Original Message -----
> From: "Brad Knowles" <brad.knowles at skynet.be>
> To: "Adam Lang" <aalang at rutgersinsurance.com>
> Cc: <bind-users at isc.org>
> Sent: Friday, May 25, 2001 1:45 PM
> Subject: Re: Scripts to start and stop
> 
> 
> >
> > At 1:36 PM -0400 5/25/01, Adam Lang wrote:
> >
> > >  so I would have soemthing like this:
> > >
> > >  $nanny_pid=`ps -aux | grep nanny.pl | awk '{print 2}'`  (would I need 2
> in
> > >  quotes?)
> >
> > This command could also catch the PID for the grep, too.  Even
> > then, it could still return multiple PIDs.  I would instead suggest:
> >
> > $NANNY_PIDS=`ps -aux | egrep 'n[a]nny.pl' | awk '{ print $2}'`
> > for PID in $NANNY_PIDS
> > do
> > kill -9 $PID
> > done
> >
> > --
> > Brad Knowles, <brad.knowles at skynet.be>
> >
> > /*        efdtt.c  Author:  Charles M. Hannum <root at ihack.net>          */
> > /*       Represented as 1045 digit prime number by Phil Carmody         */
> > /*     Prime as DNS cname chain by Roy Arends and Walter Belgers        */
> > /*                                                                      */
> > /*     Usage is:  cat title-key scrambled.vob | efdtt >clear.vob        */
> > /*   where title-key = "153 2 8 105 225" or other similar 5-byte key    */
> >
> > dig decss.friet.org|perl -ne'if(/^x/){s/[x.]//g;print pack(H124,$_)}'
> 
> 
> 



More information about the bind-users mailing list