You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Gautam Upadhyaya <ga...@yahoo.com> on 2001/10/06 08:11:23 UTC

Remote Tomcat Restarting

Hello everyone!

Recently a need came up for developing a servlet which
would allow remote configuration of Tomcat. I am
calling the shutdown and startup scripts from a batch
file. The OS is WinNT.

I have the following problem...

When I call the batch file from the servlet, the
Tomcat shutdown and startup scripts don't seem to be
working. If I call the same batch file from the
command line, everything works fine. I am using the
following syntax:

Runtime.getRuntime.exec("<path of the batch file>");

I know that the batch file is being called because
other commands (such as starting windows explorer
etc.) are working. It is just the Tomcat startup and
shutdown scripts that are not working.

What am I doing wrong? Does anyone have an alternate
solution that I could try. It is important to do this
remotely. I have even tried calling the
org.apache.tomcat.startup.Tomcat class directly. Same
problems...it works when called from the command line
but does not work if called from the servlet.

Any input would be greatly appreciated.

Thanks

Gautam Upadhyaya


__________________________________________________
Do You Yahoo!?
NEW from Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1

Re: Remote Tomcat Restarting

Posted by leandro <le...@leandro.locaweb.com.br>.
Hi Gautam,

     In my job I use the RCMD service and all work fine. You can install
this service in target server and run in your machine "rcmd \\target path of
the batch file". I think it´s solve tour problem.

Lehotle
----- Original Message -----
From: "Gautam Upadhyaya" <ga...@yahoo.com>
To: <to...@jakarta.apache.org>
Sent: Saturday, October 06, 2001 3:11 AM
Subject: Remote Tomcat Restarting


> Hello everyone!
>
> Recently a need came up for developing a servlet which
> would allow remote configuration of Tomcat. I am
> calling the shutdown and startup scripts from a batch
> file. The OS is WinNT.
>
> I have the following problem...
>
> When I call the batch file from the servlet, the
> Tomcat shutdown and startup scripts don't seem to be
> working. If I call the same batch file from the
> command line, everything works fine. I am using the
> following syntax:
>
> Runtime.getRuntime.exec("<path of the batch file>");
>
> I know that the batch file is being called because
> other commands (such as starting windows explorer
> etc.) are working. It is just the Tomcat startup and
> shutdown scripts that are not working.
>
> What am I doing wrong? Does anyone have an alternate
> solution that I could try. It is important to do this
> remotely. I have even tried calling the
> org.apache.tomcat.startup.Tomcat class directly. Same
> problems...it works when called from the command line
> but does not work if called from the servlet.
>
> Any input would be greatly appreciated.
>
> Thanks
>
> Gautam Upadhyaya
>
>
> __________________________________________________
> Do You Yahoo!?
> NEW from Yahoo! GeoCities - quick and easy web site hosting, just
$8.95/month.
> http://geocities.yahoo.com/ps/info1
>


Re: Remote Tomcat Restarting

Posted by Lyndon Samson <sa...@ozemail.com.au>.
The batch file is probably being killed when the parent ( tomcat )
process is killed in the shutdown.

Ideally you would write a little server daemon to do the
shutdown/startup call, this would run independant of tomcat.


Re: Remote Tomcat Restarting

Posted by Brian Richards <nc...@pobox.com>.
If you have tomcat setup to run as a service you might try somethign like
Runtime.getRuntime.exec("net stop tomcat");
Runtime.getRuntime.exec("net start tomcat");

Or maybe have yout btch file execute both of those commands then it depends
on a windows process not the tomcat one.

-Brian


----- Original Message -----
From: "Gautam Upadhyaya" <ga...@yahoo.com>
To: <to...@jakarta.apache.org>
Sent: Saturday, October 06, 2001 2:11 AM
Subject: Remote Tomcat Restarting


> Hello everyone!
>
> Recently a need came up for developing a servlet which
> would allow remote configuration of Tomcat. I am
> calling the shutdown and startup scripts from a batch
> file. The OS is WinNT.
>
> I have the following problem...
>
> When I call the batch file from the servlet, the
> Tomcat shutdown and startup scripts don't seem to be
> working. If I call the same batch file from the
> command line, everything works fine. I am using the
> following syntax:
>
> Runtime.getRuntime.exec("<path of the batch file>");
>
> I know that the batch file is being called because
> other commands (such as starting windows explorer
> etc.) are working. It is just the Tomcat startup and
> shutdown scripts that are not working.
>
> What am I doing wrong? Does anyone have an alternate
> solution that I could try. It is important to do this
> remotely. I have even tried calling the
> org.apache.tomcat.startup.Tomcat class directly. Same
> problems...it works when called from the command line
> but does not work if called from the servlet.
>
> Any input would be greatly appreciated.
>
> Thanks
>
> Gautam Upadhyaya
>
>
> __________________________________________________
> Do You Yahoo!?
> NEW from Yahoo! GeoCities - quick and easy web site hosting, just
$8.95/month.
> http://geocities.yahoo.com/ps/info1
>
>