process conflicts

James W. Meritt jwm at SUN4.JHUAPL.EDU
Sat May 18 05:02:56 AEST 1991


Is there some way for a script to "tell" if another process with the same
name is running?  I'm trying:
............................................................
#! /bin/csh -f
set j=`ps -ax|grep $0| grep -v grep | grep csh`
echo "got string< $j >- $#j long"
if ($#j != "7") then
      echo have more processes named $0 running
else
      echo only this process named $0 is running
endif
..........................................................

Except that the results are inconsistent, especially if the script is run via
cron.

Opinions expressed are solely those of the author, and do not necessarily
represent those opinions of this or any other organization.  The facts,
however, simply are and do not "belong" to anyone.
    jwm at sun4.jhuapl.edu or jwm at aplcen.apl.jhu.edu or meritt%aplvm.BITNET



More information about the Comp.unix.questions mailing list