Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to Run a shell script from a servlet?  RSS feed

 
vishal goyal
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Please let me know how to run a shell script from a servlet. Also please let me know how a servlet can get into the server to run the shell script as it would require the id-password for that.
Thanks and regards,
vishal
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The mechanism is exactly the same as for standalone java. You get the JavaRuntime object and invoke its exec() method. The security context is that of the servlet server - anything else would most easily be acomplished by calling a glue script in that context that suexec's the actual script.
 
vishal goyal
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim,
Thanks for help.
Still, some more help needed. Please give me some code snippet demonstrating this solution.
Am able to use exec() but am not aware of glue script or suexec.
Thanks and Regards,
vishal.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!