Script Schedules

Updated Nov 9, 2026
DataMagik Automate

What a schedule does

A schedule runs a script by the clock: a report every weekday at 6:00, a Plex sync every 15 minutes, a cleanup on the first of the month. Each schedule pairs one script with a cron expression and a time zone.

Schedules live under Script Engine › Schedules. You need the DataMagik - Builder permission to create, change or delete a schedule. People with DataMagik - Viewer can see schedules, run one now, read its history and cancel its queued runs.

Creating a schedule

Click Create Schedule and fill in the form:

FieldWhat it does
Schedule NameRequired. The name in the list, such as "Daily open orders report".
Script TemplateRequired. The script (or workflow) to run.
DescriptionOptional note about what the schedule is for.
Cron ExpressionRequired. When to run. See Cron expressions below. Starts as 0 9 * * * (9:00 every day).
TimezoneThe time zone the cron expression is read in. Starts as UTC. Pick your plant's zone, such as America/Chicago, so 6:00 means 6:00 on the shop floor, including across daylight saving changes.
Timeout (s)How long one run may take, in seconds. Starts at 30; the most is 2700 (45 minutes).
Max RetriesHow many extra attempts a run may get, from 0 to 5. Starts at 0. See Retries.
Retry runs interrupted mid-executionOff by default. See Retries before turning it on.
Enable schedule immediatelyTicked by default. Untick it to save the schedule switched off and turn it on later.

Then click Create Schedule.

The schedule's timeout is the one that counts. A scheduled run always gets the schedule's Timeout (s), even when the script's own timeout is longer. If a job needs 20 minutes, set 1200 here.

Cron expressions

A cron expression has five parts, separated by spaces: minute, hour, day of month, month, day of week.

ExpressionRuns
*/15 * * * *Every 15 minutes
0 * * * *At the start of every hour
0 6 * * 1-56:00 Monday to Friday
0 6,14,22 * * *6:00, 14:00 and 22:00 (each shift change)
0 0 1 * *Midnight on the 1st of each month
0 0 * * 0Midnight every Sunday

As you type, the form checks the expression and shows the Next 5 runs in the chosen time zone. An expression it cannot read shows an error, and the schedule cannot be saved until you fix it. Cron Helper opens a short list of common expressions you can click to use.

Check Next 5 runs before saving. It is the quickest way to catch a schedule that would run at 6:00 UTC instead of 6:00 at the plant.

The schedules list

Each schedule shows its script, cron expression, Next Run, Last Run and a Status switch. Use the search box, the Script filter and the Status filter (All Schedules, Enabled Only, Disabled Only) to narrow the list.

ActionWhat it does
Status switchTurns the schedule on or off without changing anything else.
RunRuns the script now, with the schedule's settings. It does not move the next scheduled run. A schedule can be started this way once a minute; a second click within the minute is refused.
HistoryOpens the schedule's recent runs. See History.
CancelAfter you confirm, removes this schedule's runs that are waiting in the queue and marks them cancelled. Use it when runs have piled up behind a problem. It does not stop a script that is already running.
EditOpens the same form as Create Schedule.
DeleteDeletes the schedule after you confirm. Past runs stay in Executions.

Creating, editing and deleting a schedule is recorded in the change history.

History

History lists the schedule's latest 50 runs, newest first. Each row shows the status, start time, duration and type: scheduled for a run the clock started, manual for one started with Run. A retry shows its attempt number, such as Attempt 2. A failed run shows its error message without opening it.

Click a run to see its Console output, its Output (the script's return value), its Error with the stack trace, and any documents it generated. Stopped by a restart means the run was cut short when its worker was shut down.

Scheduled runs also appear in Executions with Started by set to Schedule.

How scheduled runs behave

Timing

DataMagik checks for due schedules once a minute, so a run starts within about a minute of its time.

A run that is still going

A schedule never stacks runs on itself. If the previous run is still queued or running when the next time comes, that time is skipped and the schedule moves on to the following one. A */5 schedule whose job takes 12 minutes runs every 15 minutes in practice, not three times at once.

Missed times

If scheduling was paused (for example during maintenance) and several run times went by, the schedule runs once when scheduling resumes, then carries on from the next time. Missed times are not run one after another to catch up.

Who a scheduled run acts as

A scheduled run acts as the person who created the schedule, with that person's access, such as their SQL Access Roles. If that person no longer has access to the company, the run has no user, and anything that needs a user's access is refused. If a schedule starts failing after someone leaves, recreate it under an active user.

Scripts with no input

A schedule has no input of its own: a scheduled run starts with an empty input. A script that reads parameters from context needs defaults for its scheduled runs.

Retries

Retries are for runs that did not get to finish. Max Retries sets how many extra attempts a run may have; 3 allows four attempts in all.

  • A run that never started (no worker picked it up) is retried whenever Max Retries is above 0. Nothing ran, so nothing is repeated.
  • A run that started and was interrupted (its worker stopped part way) is retried only if Retry runs interrupted mid-execution is ticked. A retry starts the script again from the beginning, so anything the first attempt already did, such as sending an email, printing labels or writing to Plex, happens again. Tick it for jobs that are safe to repeat, such as overwriting a file or updating records by key. Leave it off for invoices, statements, EDI and anything else that must not be sent twice.
  • A run that ran to the end and failed is not retried from this screen. Fix the cause, then use Run.

A switched-off schedule is never retried.

Schedules made by workflows

A workflow with a Schedule trigger manages one schedule of its own. Saving the workflow creates a schedule named Workflow schedule, described as "Managed by the workflow canvas (Schedule trigger).", and each later save updates its cron expression, time zone and timeout to match the trigger. Its timeout is the workflow's Timeout (seconds) from Workflow settings.

  • To pause it, turn its Status switch off here. It stays off when the workflow is saved again.
  • Removing the Schedule trigger and saving deletes this schedule. Schedules you added to the workflow by hand are not touched.
  • Change its time on the workflow's trigger, not here: the next save of the workflow puts it back.
  • Do not change its description. The workflow finds its schedule by that description; if it is changed, the next save creates a second schedule.

See Workflow Triggers and Workflows in Production.

Deleted scripts

When a script or workflow is deleted, its schedules stop running. They stay in the list, so you can see what was scheduled; delete them when you no longer need them.

A schedule whose cron expression can no longer be read is switched off automatically.

Related

Was this page helpful?