onServerStart

Called upon startup of the server. Typically defined in server.cfc and placed at the webroot. In the ColdFusion Administrator > Setting check 'Component with onServerStart() method' and specify the file. The function is useful for application-independent tasks, and specifying the server specific environment variables and other general tasks.

function onServerStart() { } → returns void

This function requires Adobe ColdFusion 9 and up.  Not supported on Lucee, etc.

Links more information about onServerStart

Examples
Sample code invoking the onServerStart function

Setting server specific variables

<cfcomponent>    <cffunction name="onServerStart">        <cfset server.environment = "Dev-Server">        <cfset server.tech_support = "joe.bloggs@example.com">    </cffunction></cfcomponent>

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub