ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chuck Holzwarth <>
Subject Re: nohup and Ant question
Date Fri, 25 Jan 2008 14:39:19 GMT
You may have several problems here. 
Both nohup commands start asynchronous processes that don't end when the connection is broken
and you may end up with zombies running. 

Both nohup commands write to nohup.out with the second one probably overwriting the same file.
You can do this on Unix/Lunix etc. without a problem. The disk space is not cleared up until
the nohup process exits but is not available unless you can access the inode where the file
still exists. You can try appending ">> output 2>&1" to the end of the nohup
commands to capture all of the output.

If there are zombies, you may be getting more than one line from awk and that may not work

It looks like prstat does not like the blank pid. You may want to echo the result of the ps
as well as use it to set the pid variable for debugging purposes. Something like:
echo "Getting PS info" >> output 2>&1
ps -ef >> output 2>&1
echo "Applying awk filter" >> output 2>&1
ps -ef | awk '/'"java -server -XX:CompileThreshold"'/ && !/bash/ {print $2}'` >>
output 2>&1
pid=`ps -ef|awk '/'"java -server -XX:CompileThreshold"'/ && !/bash/ {print $2}'` 2>&1
This will give 

The fact that you are not getting the variable, pid, set is probably the key issue.

If you want to see the output as well as send it to a file, look at the tee command or the
script command instead of the ">> output"

Z W <> wrote: Hi

I have a shell script where in it, it has these lines

nohup ./mdmctl start-t -dep zg &
nohup vmstat 10 > $log_location/vmstat_$1.log &
echo "Wait to come up...sleep for 100 secs"
sleep 100
echo "Starting prstat."
pid=`ps -ef|awk '/'"java -server -XX:CompileThreshold"'/ && !/bash/ {print
echo "pid = $pid"
./test_prstat $pid > $log_location/prstat_$1.log &
echo "pid = $pid"
where mdmctl and test_prstat are additonal separate shell scripts.

When running Ant, its output s

   [rexec] Wait to come up...sleep for 100 secs
   [rexec] Starting prstat.
   [rexec] pid =
   [rexec] pid =
   [rexec] prstat: illegal argument -- -n
Terminate batch job (Y/N)? y

But when I tried running the shell script directly on a unix shell, it works
just fine,
giving output

# zach_starttest 88770099

Sending output to nohup.out
Waiting for iMDM server to come up...sleep for 100 secs
Sending output to nohup.out

I like to know if there's a way in Ant to detect "Sending output to
nohupout" response from remote unix host
so that my Ant script wouldn't hang on step
   [rexec] prstat: illegal argument -- -n

I have to terminate the Ant script on my own.


Thank you,
Chuck Holzwarth
(804) 403-3478 (home)
(540) 335-3171 (cell)
Looking for last minute shopping deals?  Find them fast with Yahoo! Search.
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message