tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergio Stateri Jr" <stat...@tesla.com.br>
Subject RES: [tomcat-devel] How to call Runtime.exec()
Date Thu, 05 Oct 2000 11:57:39 GMT
Here's a sample JSP that run any System command, since the user that run
Tomcat has sufficient rights...

PS : Send the command to be executed as the "command" URL parameter, like
this :

http://server/run_command.jsp?command=ls%20-l

(see that the command must be URL Encoded...)


Sergio Stateri Jr
stateri@tesla.com.br
Tesla Tecnologia
Sao Paulo (SP) Brazil

<%@ page
language="java"
import=	"java.io.*"
%>

<html>
<body>

<%
	String s;

	try {
	    Process myProcess =
Runtime.getRuntime().exec(request.getParameter("command"));

	    DataInputStream in = new DataInputStream(
		new BufferedInputStream(myProcess.getInputStream()));

	    while ((s = in.readLine()) != null) {
		out.println(s + "<br>");
	    }
	}
	catch (IOException e) {
	    out.println("Error: " + e);
	}
%>

</body>
</html>




-----Mensagem original-----
De: tomcat-devel-admin@lists.real-time.com
[mailto:tomcat-devel-admin@lists.real-time.com]Em nome de Pankaj Malviya
Enviada em: Quarta-feira, 4 de Outubro de 2000 19:29
Para: tomcat-dev@jakarta.apache.org
Assunto: [tomcat-devel] How to call Runtime.exec()

Hi,

I am trying to start my application server ( If it has been killed or
stopped) from Servlet by using runtime.exec() and it is not working. Do I
need to make some changes in config file or somewhere to make this happen. I
read that to do this in iPlanet Web Server some config changes are required,
whether same is the case for tomcat.

Your early help will be highly appreciated.

Wondering why my application server dies. (It is killed by process watch on
the Shared Hosting Server).


Regards

Pankaj


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org

_______________________________________________
tomcat-devel mailing list
tomcat-devel@lists.real-time.com
https://mailman.real-time.com/mailman/listinfo/tomcat-devel


Mime
View raw message