Get Scheduled Tasks and Mappings Script

I found this and wanted to blog it for my own info and someone else may find it useful. Below are code snippets to provide a list of scheduled tasks and mappings on a server - useful if you don't have administrator access to the server:

CF Scheduled Tasks

CODE:
  1. <cfobject type="JAVA" action="Create" name="factory" class="coldfusion.server.ServiceFactory">
  2. <cfset allTasks = factory.CronService.listAll()
  3. </cfset><cfset numberOtasks = arraylen(allTasks)>
  4.  <cfloop index="i" from="1" to="#numberOtasks#">
  5.    <cfoutput>
  6.            #allTasks[i].task#<br />
  7.            #allTasks[i].url#
  8.           <hr />
  9.    </cfoutput>
  10. </cfloop>
  11.  
  12. <!--- you can also dump it --->
  13. <cfdump var="#allTasks#">

ColdFusion Mappings

CODE:
  1. <cfobject action="create" type="java" class="coldfusion.server.servicefactory" name="factory">
  2.  <cfscript>
  3.    runtimeservice =    factory.getruntimeservice();
  4.    allmappings = runtimeservice.mappings;
  5.  </cfscript>
  6. <cfabort />
  7. <!--- you may also dump it --->
  8. <cfdump var="#allmappings#">

Creative Commons License

Copyright © 2007 thecrumb.com. All rights reserved.