<project name="tomcat" basedir=".">
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="${basedir}/lib/ant-contrib-1.0b3.jar" />
</classpath>
</taskdef>
<target name="linux.start.tomcat" description="starts tomcat in the current console linux">
<if>
<not>
<socket server="localhost" port="8009" />
</not>
<then>
<echo message="start tomcat..." />
<java classname="org.apache.catalina.startup.Bootstrap" spawn="yes" fork="yes">
<arg value="start" />
<classpath>
<pathelement path="${java.home}/lib/tools.jar" />
<pathelement path="./bin/bootstrap.jar" />
</classpath>
</java>
<waitfor maxwait="5" maxwaitunit="minute" checkevery="2" checkeveryunit="second">
<and>
<socket server="localhost" port="8009" />
</and>
</waitfor>
</then>
</if>
</target>
<target name="linux.stop.tomcat" description="stop tomcat in the current console linux">
<if>
<socket server="localhost" port="8009" />
<then>
<echo message="stop tomcat..." />
<java classname="org.apache.catalina.startup.Bootstrap" fork="yes">
<arg value="stop" />
<classpath>
<pathelement path="${java.home}/lib/tools.jar" />
<pathelement path="${basedir}/bin/bootstrap.jar" />
</classpath>
</java>
<waitfor maxwait="2" maxwaitunit="minute" checkevery="2" checkeveryunit="second">
<not>
<socket server="localhost" port="8009" />
</not>
</waitfor>
</then>
</if>
</target>
<target name="start.tomcat">
<exec dir="${basedir}/bin" executable="bash">
<env key="CATALINA_HOME" path="${basedir}" />
<arg value="startup.sh" />
</exec>
</target>
<target name="stop.tomcat">
<exec dir="${basedir}/bin" executable="bash">
<env key="CATALINA_HOME" path="${basedir}" />
<arg value="shutdown.sh" />
</exec>
</target>
</project>
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="${basedir}/lib/ant-contrib-1.0b3.jar" />
</classpath>
</taskdef>
<target name="linux.start.tomcat" description="starts tomcat in the current console linux">
<if>
<not>
<socket server="localhost" port="8009" />
</not>
<then>
<echo message="start tomcat..." />
<java classname="org.apache.catalina.startup.Bootstrap" spawn="yes" fork="yes">
<arg value="start" />
<classpath>
<pathelement path="${java.home}/lib/tools.jar" />
<pathelement path="./bin/bootstrap.jar" />
</classpath>
</java>
<waitfor maxwait="5" maxwaitunit="minute" checkevery="2" checkeveryunit="second">
<and>
<socket server="localhost" port="8009" />
</and>
</waitfor>
</then>
</if>
</target>
<target name="linux.stop.tomcat" description="stop tomcat in the current console linux">
<if>
<socket server="localhost" port="8009" />
<then>
<echo message="stop tomcat..." />
<java classname="org.apache.catalina.startup.Bootstrap" fork="yes">
<arg value="stop" />
<classpath>
<pathelement path="${java.home}/lib/tools.jar" />
<pathelement path="${basedir}/bin/bootstrap.jar" />
</classpath>
</java>
<waitfor maxwait="2" maxwaitunit="minute" checkevery="2" checkeveryunit="second">
<not>
<socket server="localhost" port="8009" />
</not>
</waitfor>
</then>
</if>
</target>
<target name="start.tomcat">
<exec dir="${basedir}/bin" executable="bash">
<env key="CATALINA_HOME" path="${basedir}" />
<arg value="startup.sh" />
</exec>
</target>
<target name="stop.tomcat">
<exec dir="${basedir}/bin" executable="bash">
<env key="CATALINA_HOME" path="${basedir}" />
<arg value="shutdown.sh" />
</exec>
</target>
</project>