[Gllug] Getting PIDs

Magnus Nilsson magnusn at advfn.com
Tue Aug 13 12:11:58 UTC 2002


On Tue, 2002-08-13 at 12:45, Brent Geach wrote:
> Hi all,
> 
> I was wondering if anyone knew of a nice way to get the PID of the parent of a
> process. Im writing startup scripts for a load of java apps that will spawn a
> load of children when run.
> 
> What Im using at the moment is which is a bit of an ugly hack.
> 
> pid=`ps auxwww |grep demo |grep -v initlog |grep -v bash | head -1 |awk
> '{print$2}'`
> echo 
> [ $RETVAL -eq 0 ] && shlock -p $pid -f /opt/dc/etc/dc.lock
> ;;

With 'ps axf', you get a threaded processlist. Don't really know if that
makes it harder or not though. Can't think straight right now...too
close to monday I guess..

-- 
Magnus Nilsson                  Office: +44 2070 700941
Systems Administrator           Mobile: +44 7973 796019
ADVFN.COM PLC


-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list