|
From: Leif M. <le...@ta...> - 2007-03-14 05:30:24
|
Mark,
I played around with this some more today trying to figure out what the
problem
could possibly be. The very first time I tried this today, I saw the
same thing you
did, BUT when I tried to repeat it, I was unable to. Every other
attempt results
in the script working perfectly. Are you seeing this intermittently or
does it happen
every time?
Mark Leone wrote:
> I downloaded the script two different times from the URL you provided.
> I even tried reverting back to the script in the 3.2.3 distribution,
> just to see what happens. Although I get the stale pid error with both
> versions of the script, the distribution version throws some other
> error messages relating to a keyword error, I believe; so I'm
> satisfied that I'm actually executing the new version of the script.
Ok. That does indeed sound like you are running the correct thing.
We are not seeing the same results, but I am attempting to understand why.
Could you edit your script and make following modifications in the getpid()
function:
---
case "$DIST_OS" in
'macosx')
echo "pidtest='$PSEXE -p $pid | grep
\"$WRAPPER_CMD\" | tail -1'"
pidtest=`$PSEXE -p $pid | grep "$WRAPPER_CMD" |
tail -1`
;;
*)
pidtest=`$PSEXE -p $pid -o args | grep
"$WRAPPER_CMD" | tail -1`
;;
esac
echo "pidtest=[$pidtest]"
---
The changes are to add the two echo statements. Be careful of the
regular single
quotes in the first echo.
On my system, when I check the status, I get the following:
---
myhost:~/dev/sourceforge/wrapper/test myuser$ ./action status
pidtest='/bin/ps -p 2631 | grep
"/Users/myuser/dev/sourceforge/wrapper/test/../bin/wrapper" | tail -1'
pidtest=[ 2631 p2 S+ 0:00.15
/Users/myuser/dev/sourceforge/wrapper/test/../bin/wrapper
/Users/myuser/dev/sourceforge/wrappe]
Action Test Case is running (2631).
---
AHHHH I figured it out as I wrote this. See that the second pidtest
value output is
clipped at the end? That is because the output is coming from the piped
output of the
ps command. For some reason, OSX is truncating the output lines to the
width of
the parent shell even though that process is running in the background.
If the shell width is wide, then this will work correctly. If however,
the shell with is
narrow enough that the wrapper process name is not fully listed then the
grep will
fail. See this example:
---
myhost:~/dev/sourceforge/wrapper/test myuser$ ./action status
pidtest='/bin/ps -p 2631 | grep
"/Users/myuser/dev/sourceforge/wrapper/test/../bin/wrapper" | tail -1'
pidtest=[]
Removed stale pid file:
/Users/myuser/dev/sourceforge/wrapper/test/./action.pid
Action Test Case is not running.
---
In the above case, ps returns the following:
---
PID TT STAT TIME COMMAND
2631 p2 R+ 0:00.35 /Users/myuser/dev/sourceforge/wrapper/t
---
So the grep is failing.
Anyone have any ideas on how to resolve this? I will look into it as
well...
Cheers,
Leif
|