• Post Reply Bookmark Topic Watch Topic
  • New Topic

to connect to unix system from jsp and execute the script

 
gopal krishnan
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been using JSP with TOMCAT server, running in my personal machince. i am connecting to PRODUCTION DATABASE succesfully and retrive the data from it.
But i have another requirement of connecting to unix box, and execute the script, then display the output to the JSP.

Could anyone please advice how it can be take it forward.

Thanks
Gopal

 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gopal and welcome to JavaRanch!

Firstly I'd say that you want to think really, really carefully about the design of this. Calling shell scripts directly from JSP pages is generally frowned upon and usually indicates a weakness in your MVC design and weakness in your security design. That aside you'll want to:

* Look at the Runtime class and the Process Class.

* Make sure that your web app / web container has the permissions to execute that shell script.

* Use some sort of InputStream reader in order to gather the output of the shell script.

* Also be aware of the length of time this shell script make take to execute and what should happen if the shell script hangs or fails.

Hope that helps!
 
Ananth Chellathurai
Ranch Hand
Posts: 349
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fire wall rules of the UNIX machine should allow your connections too. Have an eye on that too.

Ananth Chellathurai
 
gopal krishnan
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Currently we have the script developed in unix, to be user friendly we need to use it in JSP.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!