Scheduled jobs

A scheduled job is code that starts on a timer, completes a defined piece of work, and exits. Tokay handles the schedule, keeps the output of each run, and alerts you when a job that was working starts failing.

Last updated

A normal script is enough. Code that runs with node report.js or python sync.py can run as a scheduled job without a scheduling library.

Set the schedule in ordinary language

Enter a schedule such as “Every day at 9am,” “Every 15 minutes,” or “The first of the month.” Choose the timezone, then check the next three run times shown by Tokay.

The schedule can be changed from the Service page or Settings. The Events tab records schedule changes so an unexpected run time can be traced later.

Test the deployed job with Run Now

Run Now starts the job immediately without changing the schedule. Output streams into the page while the command runs, which lets you verify code, credentials, and database access before waiting for the next scheduled time.

Each run has its own record

The Logs tab lists scheduled and manual runs with their start time, duration, output, and result.

  • Success means the command exited cleanly.
  • Your script encountered an error means it exited with a failure and the output contains the application error.
  • Ran out of memory means the process exceeded the memory available on the Workspace server.
  • Killed / Timed out means Tokay stopped the run before it finished.

A failed run includes Copy for AI, which packages the code, runtime, and error into a prompt. See Logs and debugging.

Alerts report state changes rather than every failure

When a job that was succeeding begins to fail, Tokay emails a link to the failed run. A recovery email follows when it succeeds again. Repeated failures in the same incident do not send a new email for every run.

A scheduled job should finish

A process that should wait forever for more work is a background worker, not a scheduled job. A job that writes state needed by the next run should use /tokay/data or another persistent directory. See Files and persistent storage.

Deploying new code does not change the schedule. The next run uses the new version.