Hi,
I am trying to call a shell script from
Java and I am not sure how can I find out whether the script ran sucessfully or not.
Shell Script:ftpscript.sh
ftp -n testServer << EOD
user userName Password
bin
cd /Reports
put rpt1.csv
quit
Java Code Snippet
-----------------
Runtime myRuntime = Runtime.getRuntime();
String cmd = "command ftpscript.sh";
Process ps = myRuntime.exec(cmd);
ps.waitFor();
ps.destroy();
System.out.println("Exit Status: " + ps.exitValue() + " " + ps.toString());
Lets say user password is invalid, in that case ftpscript.sh will unable to ftp the file but from Java point of view I am getting Exit Status as ZERO (Prociess.exitValue()).
Any ideas how to know whether FTP script was sucessful or not.
Thanks.
SK