Auto-run a template after CFMX restart

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Auto-run a template after CFMX restart

    We have application-scoped variables that control user access. If we restrict
    access to certain application modules and the server goes down (scheduled
    reboots in the middle of the night, emergencies, etc.), after restart the
    application-scoped variables are wiped away, causing traffic on modules whose
    restrictions got blown away by the reboot. I'd like to run a template that
    initializes the application variables once, right after the CFMX server
    reboots. How might this be done? Many thanks. Tim

    DrAngus Guest

  2. Similar Questions and Discussions

    1. Setting Auto Restart Service for CFMX 7 instance
      I have already set up multiple CFMX 7 instances on a Windows 2003 server (using the build-in JRUN server). Upon reboot I discovered that severaI...
    2. Run Template on Restart?
      I have a template I use to initialize some application variables whenever I restart the server. Is there a way to automatically execute the template...
    3. Java Class Reload Without Restart CFMX
      How can I make my updated java classes work without restarting CFMX. This Java Classes are not a CFX tags. It is just a normal class.
    4. How do I restart CFMX server?
      I have the Coldfusion running locally on my computer to test my coldfusion pages. But when I open the pages in my browser, it says the server cannot...
    5. DW4 froze on template update, will not restart
      While trying to save an updated template, I got the error message that the template contained an invalid path or file name. I clicked on "OK"...
  3. #2

    Default Re: Auto-run a template after CFMX restart

    Just put a check in your Application.cfm file for the existence of one of those
    variables. This is part of what I've got to initialize a set of application
    variables to their default values (read from an XML file) when the application
    starts.

    Kudos to WebTricks.com for some of this code.

    HTH



    <cflock scope="application" timeout="10" type="exclusive">
    <cfparam name="application.initialized" default="false">
    <!--- Create a Request variable to hold the value so you don't need a read
    lock to get it in the next block of code. --->
    <cfset request.initialized = application.initialized>
    </cflock>

    <cfif NOT request.initialized OR IsDefined("url.init")>
    <!--- Get the default application variables and values from the configuration
    XML file. --->
    <cfset configApp = CreateObject("component",
    "com.riaservicesinc.common.xmlTools").loadXmlConfi g(ExpandPath('WEB-INF/riasConf
    ig/xml') & "/riaservicesAppConfig.xml")>

    <!--- Create an exclusive Application scope lock and set the values. --->
    <cflock scope="application" timeout="10" type="exclusive">
    <cfset application.config = Duplicate(configApp.config)>
    <cfset application.initialized = true>
    </cflock>

    </cfif>

    cf_menace Guest

  4. #3

    Default Re: Auto-run a template after CFMX restart

    Thanks for the response. I had previously considered setting such an
    application-scoped flag, but since every request for a template within the
    application would require checking the flag's status, this might mean tens of
    thousands of such checkings per day. For efficiency's sake I was hoping for a
    one-time-only solution--the one time being when the CFMX service was restarted.

    DrAngus Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139