Java hangs even though shell script’s execution is completed
I'm trying to execute a script from within my java code. The execution of the script is over(it's pid is no more), but java is stuck on waitFor() method of the shell script process!. And yes, I'm reading output and error streams in 2 separate threads. Yes, they are being joined at the end(after waitFor()).
The aspect which makes this question relevant to this forum is, if I put the following line in the shell script(at the top), everything seems to work fine.
And no, interestingly enough, the script doesn't generate any output!. Zero chars!. So putting exec statement there makes no sense!
But still, magically enough, putting exec statement in the script makes java work!. Why??
How can I avoid that illogical exec statement in the script?.
exec has any other functionality here, other than redirection?
P.S: This definitely has got something to do with exec command, hence, this question is meant for shell/script guys and not necessarily for Java guys.
Hi,
I am having a shell script on Solaris 10 which has a while loop as shown below.
#!/usr/bin/ksh
#
while
do
sleep 60
done
Name of the shell script is coldcentric.sh. I executed script /DATAWAREHOUSE/LOAD/Scripts/coldcentric.sh from a command task in Informatica worklow as... (3 Replies)
I have a master shell script which calls some 40 shell scripts. All the shell scripts calls a sql file which executes some sql statements.
I run these scripts in parallel such that it saves me time. When i executed them i saw some strange behavior.
Firstly, I found that some scripts among the 40... (1 Reply)
HI,
I have a strange problem. A shell script that runs fine on solaris. when i ported to linux, it started hanging.
here is the core of the script
CFG_FILE=tab25.cfg
sort -t "!" -k 2 ${CFG_FILE} | egrep -v "^#|^$" | while IFS="!" read a b c
do
#echo "jobs output"
#jobs
#echo "jobs... (13 Replies)
How can I get around this? when my program reaches the following popen job it halts the program until the ping/netstat/ipconfig/traceroute is completed then resume to the rest of the program...
FILE *in;
extern FILE *popen();
char buff;
char newline;
char nstat;
char nping;
... (5 Replies)
Hello All,
Hope all is well. I am newbie to Shell programming and when I execute simple Java program from Shell script it does not return the control to the command prompt ... it hangs. When I hit "ENTER" or any other command , I get the control back. My java code has nothing but... (10 Replies)
Hello All,
Hope all is well. I am newbie to Shell programming and when I execute simple Java program from Shell script it does not return the control to the command prompt ... it hangs. When I hit "ENTER" or any other command , I get the control back. My java code has nothing but... (1 Reply)
if
then
# mail -s "Import failed file does not exist" sanjay.jaiswal@xyz.com
echo "FILE does not exist"
exit 1
fi
echo "FILE EXIST"
size=-1
set $(du /export/home/oracle/nas/scott21.dmp.gz)
while
do
echo "Inside the loop"
size=$1
set $(du... (1 Reply)
Hi
I need to run a shell script from a TCL script,the shell script in trun will run a python script
1.Tcl script
set filename "./GopiRun.sh"
2.GopiRun.sh
python ./psi.py $MYSB/test_scripts/delivery/gpy1.py
3.I have my gpy1.py script.
Here the problem i am facing is on running... (0 Replies)
Hello,
I am new to this forum and relatively new to unix, but hope to become an expert soon!
My question is: How can I find out the execution time of a command that has already completed execution? More specifically, I launched a Python script to populate a PostgreSQL database on Suse... (2 Replies)