Schedules
Run a job automatically on a cron timetable.
A Schedule is a Job that Coderunner starts for you on a timetable. Use it for daily reports, periodic imports, data syncs, cleanups and notifications.
Write the handler
A Schedule uses the same handler as a Job. Its payload is usually empty, so read any settings from environment variables or your own code:
const handler = async (context, payload) => {
const region = process.env.REPORT_REGION ?? "all";
await sendDailyReport(region);
console.log(`Daily report sent for ${region}`);
};
module.exports = { handler };Set the timetable
A timetable is a cron expression: five fields for minute, hour, day of month, month and day of week. Times are in UTC.
| Expression | Runs |
|---|---|
0 0 * * * | Every day at 00:00 UTC |
0 9 * * 1-5 | At 09:00 UTC on weekdays |
*/15 * * * * | Every 15 minutes |
The Client Portal's schedule builder doesn't convert from your local time yet: the hour you pick is used as UTC. To run at 09:00 in a timezone that is UTC+2, choose 07:00.
Deploy it
Go to Build → Coderunner, create a Coderunner with the Schedule type and enter the cron expression. Upload your ZIP and deploy the new version once it's built. You can change the expression when you deploy.
gf deploy --name daily-report --workload-type schedule --schedule "0 9 * * *"Or keep the settings in a groundfloor.json file next to your code, so gf deploy needs no flags:
{
"name": "daily-report",
"runtime": "node",
"workloadType": "schedule",
"schedule": "0 9 * * *"
}Check that it's running
A Schedule has no public URL. To see its timetable and how its last run went:
- Client Portal: open the Coderunner. Its runs and their output are in Observe → Process Log.
- CLI:
gf coderunner status -c daily-reportprints the type, the timetable and the last run's status:succeeded,failedorrunning.
Next steps
- Jobs — how a run succeeds or fails.
- Configuration and secrets — give your Schedule settings and secrets.
- Logs and troubleshooting — investigate a failed run.