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-sync",
"name": "Nightly sync",
"command": "python sync.py [--date {date}]",
"timeout": 600,
"hosts": ["api.shop.example", "api.warehouse.example"],
"inputSchema": {
"type": "object",
"properties": { "date": { "type": "string", "title": "Day (YYYY-MM-DD)" } }
}
}
sync.py
import argparse, datetime, json, sys
yesterday = datetime.date.today() - datetime.timedelta(days=1)
parser = argparse.ArgumentParser()
parser.add_argument("--date", default=yesterday.isoformat())
day = parser.parse_args().date
pages = list_order_pages(day) # your code, reading api.shop.example
for i, page in enumerate(pages, 1):
copy_page(page) # your code, writing to api.warehouse.example
print(f"::progress {i * 100 // len(pages)} Page {i} of {len(pages)}", file=sys.stderr, flush=True)
print(json.dumps({"day": day, "pages": len(pages)}))

Reminix leaves [--date {date}] out of the command when you give no date, so the script syncs yesterday. A line on standard error that starts with ::progress, then a percentage and a message, drives the progress bar on the run’s page. Every other line the script writes to standard error appears in the run’s log as it’s written.

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

The run answers at once (202), and the CLI 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.

With a staging environment, try it there first: add --environment staging, and the run uses staging’s secret values and rules, while production stays untouched. See Environments.

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.
  • Each run starts on a fresh machine, so the sync can’t keep files from one night to the next. Keep its state in the systems it syncs.
  • Its minutes count toward the plan’s long-run minutes for the month.

Related: Long runs, Environments, Schedules and triggers.