Skip to content

Run a nightly sync

Say a sync copies yesterday’s orders from one system to another, takes about ten minutes, and runs on one person’s laptop. Nobody else can see whether it ran, or why it failed. Long runs need the Team or Business plan.

In reminix.json, set timeout in seconds. The run lasts at most this long, or the plan’s longest run (10 minutes on Team, 15 on Business), whichever is shorter:

{
"slug": "nightly-orders-sync",
"name": "Nightly orders sync",
"entry": "index.ts",
"timeout": 600,
"hosts": ["api.shop.example", "api.warehouse.example"],
"inputSchema": {
"type": "object",
"properties": { "date": { "type": "string", "title": "Day (YYYY-MM-DD)" } }
}
}
export default async function run(inputs: { date?: string }, ctx) {
const day = inputs.date ?? yesterday();
const pages = await listOrderPages(day); // from api.shop.example
for (let i = 0; i < pages.length; i++) {
await copyPage(pages[i]); // to api.warehouse.example
ctx.progress((i + 1) / pages.length, `Page ${i + 1} of ${pages.length}`);
}
return { day, pages: pages.length };
}

ctx.progress drives the progress bar on the run’s page, and ctx.log lines appear there as they’re written.

Terminal window
reminix scripts publish ./nightly-orders-sync --publish
reminix scripts run nightly-orders-sync --input '{"date":"2026-10-04"}'

The run answers at once (202), and the command line follows it to the end. In the app, the run’s page shows the log and the progress, and a Cancel run button stops it.

Add a schedule, for example every day at 2:00 in your timezone, with no inputs so it syncs yesterday. Then add a trigger for when it fails: see Alert when a run fails.

  • A long run is never retried automatically, so a sync that might stop halfway should be safe to run again for the same day.
  • A run has up to 60 seconds of CPU time. Waiting on APIs doesn’t count, so a sync that mostly reads and writes over the network fits easily.
  • Its minutes count toward the plan’s long-run minutes for the month.

Related: Long runs, Schedules and triggers.