- Posted by: Ashish Kasangottuwar
- Posted on: June 01 2001 14:20 EDT
I am trying a wierd combination of using shell scripts to run jobs on server. I need some parameters to be passed to scripts from HTML form, I am trying to use servlets for this. Can one advice how to pass parameters to shell script using servelts ans HTML form.
- servlets and shell scripts by Easwar Thondikulam on June 01 2001 15:10 EDT
- servlets and shell scripts by Andy Nguyen on June 01 2001 15:19 EDT
- servlets and shell scripts by Aditya Anand on June 04 2001 17:11 EDT
If you are using Oracle as a Database, it is possible to do what you want by making the Servlet invoke an External Proc which in turn can kick off a Shell script.
If you are not Using Oracle then sorry for this answer.
It shouldn't be too hard. You'll have to fork a process with Runtime.getRuntime().exec(...). Read your params from the request, build your command-line, and feed it to Runtime.exec().
Reading parameters from request is clear and so is for the script to read command line parameter. Can you please elaborate on how to build a command line.
just a comment to compliment this... pass parameters as an array of strings... rather than a complete string, the first element is the actual command followed by the arguments... its faster that way....so Runtime.getRuntime().exec(cmdArray);
Thanks Aditya for the comment.
Can you giude me where can I get additional related details?