Skip to main content
Known Participant
March 30, 2011
Question

Restart App from code

  • March 30, 2011
  • 2 replies
  • 584 views

Hello,

I'm using this code to restart the application without restarting the server

    <!--- onapplicationstart --->
    <cffunction name="onApplicationStart" returnType="boolean" output="true">
        <cfoutput>restarted #now()#</cfoutput>
        <cfdump var="#this.ormsettings#">
        <cfreturn true>
    </cffunction>
   
   
    <!--- onrequeststart --->
    <cffunction name="onRequestStart"  access="public" output="true">
        <cfargument name="Page" type="string" required="true" />
        <cfif StructKeyExists(URL,"app-restart")>
            <cfset OnApplicationStart()>
            <cfreturn true>
        </cfif>
    </cffunction>

Using a url like this index.htm?app-restart=1

Still, tables aren't created from the orm procedure (I'm using dropcreate as dbcreate orm setting). Is there something wrong within the code?

Thank you very much

This topic has been closed for replies.

2 replies

Fernis
Inspiring
April 19, 2011

Use ApplicationStop()  - the next page request after that should then again restart the application. This will also rebuild ORM configuration, if that interests you.

-Fernis

Participating Frequently
March 31, 2011

If you call OnApplicationStart method explicitly, ColdFusion does not start the application. It only executes the code inside the OnApplicationStart function.

FYI - http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7d48.html