[comp.unix.questions] HP-UX 7.0 problems with ps

QQ11@LIVERPOOL.AC.UK (08/11/90)

I have a simple csh script which ran without any problems at HP-UX 3.1
on our 9000/850. However at 7.0 the behaviour is different. The different
behaviour has proved consistent enough for me to seek help from you.

The script fetches a file from another system every 24 hours and the
script is started by cron(1M). The process waits until the file arrives.
If for  some reason the  transfer has not taken  place 24 hours  later, I
want the  earlier process killed. The  following line of code  is used to
find the old PID.

set exists=`ps -uqq11 | awk '$4 == "getus.csh" && $1 != x { print $1 }' x=$$ -`

This looks for the PIDs of the program and finds the older one if it
exists (if it is found kill(1) is used).

This worked fine at HP-UX 3.1 but at 7.0 a "spurious" PID is found
(presumably as a result of executing part of the above pipe). The
resulting kill(1) fails since the process is already dead.

Here is output of ps -uqq11 in same script before the pipe:

 11752 ?        0:00 sh
 11942 ?        0:00 ps
 11764 ?        0:00 getus.csh

I would be grateful if any HP-UX 7.0 guru can explain precisely what is
happening i.e. why does the other process get included at 7.0 and not
at 3.1 (for 9000/300 fans, HP-UX 3.1 on the 800 was similar to
6.5 on the 300s).

While I'm aware that I can do the whole thing differently
(send *good* suggestions to me if you want :-)), I'd like to get to
the root of the problem.

Thanks.

Alan Thew
University of Liverpool Computer Laboratory
Bitnet/Earn: QQ11@LIVERPOOL.AC.UK or QQ11%UK.AC.LIVERPOOL @ UKACRL
UUCP       : ....!mcsun!ukc!liv!qq11        Voice: +44 51 794 3735
Internet   : QQ11@LIVERPOOL.AC.UK or QQ11%LIVERPOOL.AC.UK @ NSFNET-RELAY.AC.UK