Results 1 to 8 of 8

Thread: Tomcat shutdown.bat from ant?

  1. #1
    Join Date
    Feb 2006
    Posts
    164

    Default Tomcat shutdown.bat from ant?

    Hi.

    In the airline sample app, there are several useful-looking ant/tomcat commands, with which you can deploy your app to tomcat from ant. One that I can't find, though, is a shutdown target.

    This tomcat-launch target works for me (again, taken from the airline sample):
    Code:
    <target name="tomcat-launch" depends="tomcat.init" description="Launch the tomcat server process">
    		<exec dir="${tomcat.dir}/bin" executable="startup.bat" spawn="true" vmlauncher="false">
    			<env key="JAVA_OPTS" value="${tomcat.javaopts}" />
    		</exec>
    </target>
    This tomcat-shutdown target, that I wrote returns a "BUILD SUCCESSFUL", but doesn't shutdown tomcat:

    Code:
    <target name="tomcat-shutdown" depends="tomcat.init" description="Shutdown the tomcat server process">
    		<exec dir="${tomcat.dir}/bin" executable="shutdown.bat" spawn="true" vmlauncher="false">
    			<env key="JAVA_OPTS" value="${tomcat.javaopts}" />
    		</exec>
    </target>
    Anyone know why not, and what I need to do to get it to work?

    I've googled around on this a bit, but haven't found anything signif yet.

    Ben

  2. #2
    Join Date
    Dec 2005
    Location
    U-241
    Posts
    237

    Default

    Quote Originally Posted by benethridge
    what I need to do to get it to work?
    Ditch Redmond?
    Here what I am running on Fedora and no problemo!
    Code:
    <target name="tomcat.stop">
    		<exec dir="${tomcat.home}/bin" executable="shutdown.sh" spawn="true" />
    	</target>
    Finita!
    Spring, it's a wonderful thing...

  3. #3
    Join Date
    Feb 2006
    Posts
    164

    Default

    Yes, that's pretty much what I had. For some reason (you see it?) it didn't work for me. Here's one I found on google and modified, that does work:
    Code:
    <target name="tomcat-shutdown">
    	<java classname="org.apache.catalina.startup.Bootstrap" fork="yes">
    	<jvmarg value="-Dcatalina.home=${tomcat.dir}" />
    	  <arg value="stop" />
    	   <classpath>
    	     <fileset dir="${tomcat.dir}">
    	       <include name="bin/bootstrap.jar" />
    	     </fileset>
    	   </classpath>
    	 </java>
    </target>
    Ben

  4. #4
    Join Date
    Dec 2005
    Location
    U-241
    Posts
    237

    Default

    Oh man...
    3 lines of code against how many lines?
    I do not know what's going on with your Windoz. Mine Linux is just fine with 3 LOC.
    Sorry friend ;(
    Spring, it's a wonderful thing...

  5. #5
    Join Date
    Feb 2006
    Posts
    164

    Default

    I don't know either, but the bottom line is that it works, and the 3 lines doesn't, so I'll take that any day, unless someone knows why it's not working in Windows.

    Ben

  6. #6
    Join Date
    Aug 2006
    Posts
    2

    Default

    Probably the 3 lines "solution" does not work because it is not portable?
    The executable on Windows is a BAT file and not a shell script.

    /rafa

  7. #7
    Join Date
    Dec 2005
    Location
    U-241
    Posts
    237

    Default

    I gather it's a good example of elegance of Linux (3 LOC - everything straight to the point) and bloatness of Windows.
    A simple task requires 'The War and Peace' coding.
    But it's just me. What can I say, I love 'lean and mean' approach.
    Sorry for offtop.
    Spring, it's a wonderful thing...

  8. #8
    Join Date
    Feb 2006
    Posts
    164

    Default

    I agree. I've always liked Unix better as an "industrial strength" operating system.

    No offense taken.

    Ben

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •