I’ve a situation where I need to run a Unix script from webMethods. How do I achieve this. Server may not be running on the same box or there may not be any IS on the box where the scripts reside. I should be able to invoke this remotely.
Thanks Guys. That helped me. But I have another problem. The actual script to run is as follows.
su - omidevl -c “/opt/omi/utility/scripts/uuts702 WPUJ130”.
I had problems in java for the double quotes. I used the escape character and finally I could get the command string into the method. Runtime.getRuntime().exec().
But it is not executing it and returns the code 0f 1.
I added the string to the pipeline.
When I copied the same and run on the console it runs fine.
So, in Runtime.getRuntime().exec() method it is getting confused.
Then I created another script to hold the entire command ran that script alone. It worked fine.
But I want to know, why it is not working when I pass the whole string to exec() method.
Ensure that you’re catching the stderr of the executable: see java.lang.Process (getErrorStream).
There’s a post floating around on wmusers where this is discussed. I had a quick look through the archives but it wasn’t immediately obvious. If you can’t find it google on Runtime.exec(…) and look for discussions about using InputStreams to hook up to the stdout, stdin, and stderr or executables.
“bdf: |awk: No such file or directory
bdf: ‘{print: No such file or directory
bdf: $1,$5,$6}’: No such file or directory
bdf: >/packages/***/config/DiskMonitoring1.txt: No such file or directory”.
Tell us more about how you are calling the unix script (are you using PSUtilities command line exec tool, are you calling it from your java script, etc)?
The more detail you give, the more likely someone can help without just taking a guess - as I did last post.