Skip to content

Instantly share code, notes, and snippets.

@hideshi
Created December 24, 2013 15:35
Show Gist options
  • Save hideshi/8114812 to your computer and use it in GitHub Desktop.
Save hideshi/8114812 to your computer and use it in GitHub Desktop.
Simple job scheduler with Apache Ant.
<?xml version="1.0" ?>
<project default="main" basedir="/path/to">
<target name="main" depends="begin, A0001, B0001, C0001, end">
</target>
<target name="begin">
<echo>
Begin execute jobnet.
</echo>
</target>
<target name="A0001">
<exec executable="${basedir}/A0001.sh"
failonerror="false"
resultproperty="a0001">
<arg value="0"/>
</exec>
<condition property="a0001_res">
<equals arg1="0" arg2="${a0001}"/>
</condition>
</target>
<target name="B0001" if="a0001_res">
<parallel>
<exec executable="${basedir}/B0001.sh"
failonerror="false"
resultproperty="b0001_0">
<arg value="0"/>
<arg value="0"/>
</exec>
<exec executable="${basedir}/B0001.sh"
failonerror="false"
resultproperty="b0001_1">
<arg value="0"/>
<arg value="1"/>
</exec>
<exec executable="${basedir}/B0001.sh"
failonerror="false"
resultproperty="b0001_2">
<arg value="0"/>
<arg value="2"/>
</exec>
</parallel>
<condition property="b0001_res">
<and>
<equals arg1="0" arg2="${b0001_0}"/>
<equals arg1="0" arg2="${b0001_1}"/>
<equals arg1="0" arg2="${b0001_2}"/>
</and>
</condition>
</target>
<target name="C0001" if="b0001_res">
<exec executable="${basedir}/C0001.sh"
failonerror="false"
resultproperty="c0001">
<arg value="0"/>
</exec>
<condition property="c0001_res">
<equals arg1="0" arg2="${c0001}"/>
</condition>
</target>
<target name="end">
<echo>
End execute jobnet.
</echo>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment