An Architect's View

CFML, Clojure, Software Design, Frameworks and more...

An Architect's View

Restarting Railo with Ant

November 10, 2009 · No Comments

On Twitter, Marc Esher just asked if my Scala compile-deploy process also included restarting Railo to pick up the new JAR file. Yes. I do it via Ant as follows:
<target name="restartrailo" description="Restarts the Railo server.">
      <get
         src="http://${server.name}:${server.port}/test/command/restart_server.cfm?admin_password=${admin.password}"
         dest="${www}/test/command/restart_output.txt"/>
      <loadfile property="restart.status" srcFile="${www}/test/command/restart_output.txt"/>
      <echo message="Restart status: ${restart.status}"/>
      <delete file="${www}/test/command/restart_output.txt"/>
   </target>
restart_server.cfm looks like this:
<cfsilent>
   <cftry>
      <cfadmin
         action="restart"
         type="server"
         password="#url.admin_password#"
         remoteClients=""/>

      <cfset status = "RESTARTED"/>
   <cfcatch type="any">
      <cfset status = "FAILED: #cfcatch.message# (#cfcatch.type#)"/>
   </cfcatch>
   </cftry>
</cfsilent><cfoutput>#status#</cfoutput>
A failure to restart Railo does not cause the build to fail (but it probably should - I ought to set the HTTP status to 500 if I get an exception to cause the Ant get task to fail).

Tags: railo

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment

Leave this field empty