-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Rob,

On 10/11/2010 8:43 AM, Rob Gregory wrote:
> I call the scripts via code to both stop and start Tomcat. There is a
> problem with even calling these scripts via Unix unless you change (cd)
> into the bin directory before running startup.sh as the log paths are
> generated relative to the startup.sh location.

The cwd of the process is irrelevant: the script determines the Tomcat
directory from the location of the script itself.

>       String strCatalinaBin = System.getenv("CATALINA_HOME") +
> "\\bin\\";
>       File objDir = new File(strCatalinaBin);
>       r = Runtime.getRuntime();
>       p = r.exec(new String[] { "cmd.exe", "/C", "start",
> strCatalinaBin + "catalina.bat", "start" }, null, objDir);

Note that you are not invoking catalina.bat directly, but instead
invoking the "start" command to invoke catalina.bat.

>       p.waitFor();
>       p.destroy();

This may stall if the script generates more than a trivial amount of
input. It's always best to drain both the stdout and stderr streams of
any process you launch in order to avoid hangups.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAky1/rQACgkQ9CaO5/Lv0PDFbACgn6vDOcb0IswVezPZ0NwRdIWi
hZEAoJWH8NM9czRxSY49nO7uzPJxTZ0q
=yWZ2
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to