Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with running a shell script from the JSP

Harish Kumar
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,
I am having a problem when I am trying to execute the shell script from my JSP file.
my code:
Runtime r = Runtime.getRuntime();
Process p = null;
String cmd[] = {"/bin/sh", "-c" , "/root/"};
InputStreamReader isr = new InputStreamReader(p.getInputStream());
BufferedReader br = new BufferedReader(isr);
String line = null;
while ((line=br.readLine())!=null)
{ out.println(line); }
there is no error shown its calmly navigating to next page without executing the "" file. The case is something like once the user logs in the site a server should automatically start. Please let me know what is wrong with the code i mentioned above and also if you have anyother ways to go on with this.
thank you,
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic