Introduction
These downloadable ColdFusion Scheduled Task Import/Export Scripts provide a reliable, repeatable way to back up, migrate, clone, and Audit your CF Scheduled tasks across environments. Whether you manage Adobe ColdFusion or Lucee servers, the scripts simplify moving scheduler definitions between development, staging, and production. They are valuable for teams adopting CI/CD, administrators preparing for server upgrades, and consultants who need quick, consistent task replication without manual re-entry in the Admin.
H2: What You’ll Get
- scripts/exportTasks.cfm: Exports all Scheduled tasks to a JSON file.
- scripts/importTasks.cfm: Imports tasks from JSON; supports overwrite, skip, and dry-run modes.
- cfml/modules/Scheduler.cfc: Reusable helper component for normalization between Adobe CF and Lucee, and cron/interval modes.
- schemas/tasks.schema.json: JSON schema used to validate exported/imported task definitions.
- samples/sample-tasks.json: Example export showing common attributes (HTTP URL, cron triggers, credentials).
- wrappers/run-export.sh / run-export.ps1: CLI wrappers to run exports unattended (cron/Task Scheduler compatible).
- wrappers/run-import.sh / run-import.ps1: CLI wrappers for automated imports with flags.
- config/.env.example: Environment variable template for paths, defaults, and secrets.
- docs/README.pdf: Step-by-step illustrated guide and Troubleshooting notes.
Tip: All CFML is provided in both tag-based and script-friendly approaches where appropriate. The JSON schema improves safety when committing task configs to Version control.
H2: Overview
H3: Why these scripts
- Manual entry of scheduled tasks is error-prone and time-consuming.
- Admin UI variations between Adobe ColdFusion and Lucee complicate migrations.
- Backing up tasks ensures Disaster recovery and Compliance-ready audits.
- Automated import/export enables consistent deployments in containers and VMs.
H3: What they do
- Export: Reads all tasks via cfschedule and serializes to normalized JSON with engine/version metadata.
- Import: Recreates tasks from JSON, with options to overwrite or skip existing ones, and to “dry run” without changes.
- Normalize: Handles differences between cron vs. interval jobs, time zones, start/end windows, and HTTP request options.
H2: Supported Environments
- Adobe ColdFusion: 11, 2016, 2018, 2021, 2023 (cron expressions supported in CF11+; best coverage in 2018+).
- Lucee: 5.3.x and 6.x.
- Operating Systems: Windows, Linux, macOS.
- Deployment: Works on bare-metal, VMs, containers (Docker), and CommandBox servers.
- Permissions: Requires that cfschedule is allowed on the server (per your lockdown profile).
Note: Optionally, you can adapt these scripts to use the Admin API. The default approach uses cfschedule to maximize cross-engine compatibility.
H2: File Contents and Roles
H3: Files and descriptions
- scripts/exportTasks.cfm: Enumerates and writes tasks to ./exports/tasks-YYYYMMDD.json.
- scripts/importTasks.cfm: Reads tasks from ./imports/tasks.json and recreates them.
- cfml/modules/Scheduler.cfc: Encapsulates normalization logic and shared utility functions.
- schemas/tasks.schema.json: Validates fields such as task name, group, URL, cron/interval, start/end dates, and http credentials.
- samples/sample-tasks.json: Demonstrates best-practice fields and cron usage.
- wrappers/run-*.sh / .ps1: Non-interactive harness for Automation with logs and exit codes.
- docs/README.pdf: Full documentation including screenshots and edge cases.
H2: Benefits and Use Cases
H3: Benefits
- Faster migrations: Export from source, import to target in minutes.
- Consistency: Eliminates typos and misconfigurations across environments.
- Backup and recovery: Keep a versioned JSON snapshot of scheduler state.
- DevOps-ready: Integrate with CI/CD, Docker entrypoints, or CommandBox.
- Auditable: Human-readable JSON with timestamps and engine metadata.
H3: Use cases
- Upgrading from CF2018 to CF2023 or Lucee 5.3 to 6.x.
- Cloning projects for new clients.
- Disaster recovery drills.
- Rehydrating tasks in containers during startup.
- Bulk updates to task intervals or cron expressions via JSON edits.
H2: Installation and Setup
H3: Prerequisites
- ColdFusion or Lucee instance with cfschedule enabled.
- File system write access to the scripts and output directories.
- Optional: CommandBox if you want to run via box start and scheduled shell tasks.
- Optional: Docker users should add the scripts to the image or mount a volume.
H3: Steps
- Download and extract
- Unzip the package into a directory accessible by your CF/Lucee webroot or a mapped folder (e.g., /var/www/cf-scheduler-tools or C:\inetpub\wwwroot\cf-scheduler-tools).
- Configure environment
- Copy config/.env.example to .env and edit:
- EXPORT_DIR=./exports
- IMPORT_DIR=./imports
- DRY_RUN=false
- OVERWRITE=true
- Place your JSON to import in IMPORT_DIR as tasks.json.
- Verify permissions
- Ensure the CF service user can read/write EXPORT_DIR and IMPORT_DIR.
- Confirm the server allows cfschedule operations (CF Admin / Security settings).
- Run a quick export test
- Navigate to scripts/exportTasks.cfm in your browser or via cfhttp/CommandBox:
- The script writes a file like exports/tasks-20240130.json.
- Review the JSON to confirm expected fields.
- Run an import in dry-run mode
- Set DRY_RUN=true in .env or call wrappers/run-import.sh –dry-run.
- The script reports actions without making changes.
- Perform the actual import
- Set DRY_RUN=false and run the import again.
- Check the CF Admin scheduler page to confirm tasks were created/updated.
- Automate (optional)
- Linux cron example:
- 0 2 * /path/to/wrappers/run-export.sh >> /var/log/cf-export.log 2>&1
- Windows Task Scheduler:
- Schedule wrappers\run-export.ps1 with highest privileges and proper working dir.
H2: How the Scripts Work
H3: Export core (CFML tag-based)
Example snippet from exportTasks.cfm:
H3: Import core (CFML tag-based)
Example snippet from importTasks.cfm:
<cfif dryRun>
<!--- Report only --->
<cfoutput>Would #exists AND overwrite ? "replace" : (exists ? "skip" : "create")#: #taskName# in group #group#<br></cfoutput>
<cfelse>
<cfif exists AND overwrite>
<cfschedule action="delete" task="#taskName#" group="#group#">
</cfif>
<!--- Create/update task; supports either cron or interval --->
<cfif structKeyExists(t, "cron") AND len(t.cron)>
<cfschedule
action="update"
task="#taskName#"
group="#group#"
operation="HTTPRequest"
url="#t.url#"
startdate="#t.startDate ?: dateFormat(now(),'mm/dd/yyyy')#"
starttime="#t.startTime ?: timeFormat(now(),'hh:mm tt')#"
cron="#t.cron#"
pauseonerror="#t.pauseOnError ?: false#"
requesttimeout="#t.requestTimeout ?: 60#"
username="#t.httpUsername ?: ''#"
password="#t.httpPassword ?: ''#"
>
<cfelse>
<cfschedule
action="update"
task="#taskName#"
group="#group#"
operation="HTTPRequest"
url="#t.url#"
interval="#t.interval ?: 60#"
startdate="#t.startDate ?: dateFormat(now(),'mm/dd/yyyy')#"
starttime="#t.startTime ?: timeFormat(now(),'hh:mm tt')#"
enddate="#t.endDate ?: ''#"
endtime="#t.endTime ?: ''#"
pauseonerror="#t.pauseOnError ?: false#"
requesttimeout="#t.requestTimeout ?: 60#"
username="#t.httpUsername ?: ''#"
password="#t.httpPassword ?: ''#"
>
</cfif>
</cfif>
Notes:
- Attributes differ slightly across engines and versions; the included Scheduler.cfc normalizes many of these.
- For secure deployments, prefer environment variables or secrets injection for httpPassword and avoid committing secrets.
H2: Best practices
- Use Version control: Commit exports and schema; exclude secrets (use placeholders).
- Embrace “dry run”: Validate changes in staging before production imports.
- Prefer cron expressions: Cron is more expressive and portable than legacy intervals.
- Keep time zones consistent: Set JVM time zone explicitly; document any daylight-saving expectations.
- Secure secrets: Use environment variables or encrypted storage (e.g., JCEK, vaults).
- Validate with schema: Run your task JSON through schemas/tasks.schema.json pre-import.
- Log everything: Keep export/import logs for auditing and rollbacks.
- Container tip: Make the import part of entrypoint logic so tasks rehydrate on startup.
H2: Pros and cons
H3: Pros
- Engine-agnostic via cfschedule.
- JSON-based, easy to diff and review.
- Scripted, automatable, and DevOps-friendly.
- No server restarts required.
H3: Cons
- Admin policies may restrict cfschedule usage on hardened servers.
- HTTP credentials handling requires careful secrets management.
- Edge-case attributes can differ across older engines.
H2: Security Considerations
- Never store admin or HTTP passwords in plain text in your repo.
- Mask or omit credentials in exported files; re-inject via environment or a secure vault at import time.
- Restrict access to export directories and logs.
- Use HTTPS URLs for HTTPRequest tasks; ensure the JVM truststore has required CAs.
- Review CF/Lucee lockdown guides and ensure only authorized users can run these scripts.
H2: Integrations and Automation
H3: CommandBox
- You can run the scripts on an ad-hoc server:
- box server start
- hit http://127.0.0.1:port/cf-scheduler-tools/scripts/exportTasks.cfm
- Or wrap with box task runners calling the CFML endpoints.
H3: Docker
- COPY the scripts into your image or mount via volume.
- Add a startup step:
- RUN or CMD wrappers/run-import.sh –overwrite –no-dry-run
- Persist exports to an external volume for backups.
H2: Troubleshooting
- 403/CSRF errors: If using Admin API alternatives, include proper tokens; with cfschedule, ensure the tag is permitted.
- Task not appearing: Verify group names and that “paused” status isn’t hiding execution.
- Credentials failing: Confirm username/password fields match your engine version; test the URL independently.
- Time drift: Check container/JVM time zone and NTP synchronization.
- SSL handshakes: Import public certs into cacerts or configure truststore path.
H2: Key Takeaways
- These scripts give you a safe, repeatable way to export/import ColdFusion and Lucee scheduled tasks using JSON.
- They reduce Migration time, improve consistency, and enable automation in CI/CD and containers.
- Built-in dry-run, overwrite/skip logic, and schema validation help you avoid surprises.
- Security is prioritized by supporting environment-based secrets and minimal exposure of credentials.
H2: FAQ
H4: Do I need Admin access to use these scripts?
Not necessarily. The default implementation uses cfschedule, which runs within CFML code and typically does not require Admin login, provided your server allows scheduler operations. On locked-down servers, you may need to adjust Security settings or switch to the Admin API variant.
H4: Are cron expressions supported?
Yes. If your engine/version supports cron on cfschedule (Adobe CF 11+ and Lucee), the importer will honor a cron attribute. Otherwise, it falls back to interval-based scheduling.
H4: How are HTTP credentials handled?
The exporter omits sensitive fields by default. You can keep placeholders in JSON and inject values at import time via environment variables or a vault. Avoid committing real passwords to version control.
H4: Can I run this without installing on the target server?
Yes. You can run the scripts from a temporary mapped directory or a CommandBox-powered Local server that points to your project. For remote servers, deploy the scripts, run the import/export, then remove them if desired.
H4: What about differences between Adobe ColdFusion and Lucee?
The included Scheduler.cfc normalizes most common attributes and behaviors. Some edge cases (e.g., less-common HTTP options) may vary by engine/version; consult docs/README.pdf and test with dry-run before final imports.
