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 Pro or Business plan.

In reminix.json, set timeoutSeconds. The run can last up to that long. The plan caps it at 10 minutes on Pro and 15 on Business:

{
"slug": "nightly-sync",
"name": "Nightly sync",
"command": "python sync.py [--date {date}]",
"timeoutSeconds": 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)}))

When you give no date, Reminix leaves [--date {date}] out of the command, 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 the script writes it.

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

The request returns 202 right away, and the CLI follows the run to the end. In the app, the run’s page shows the log and the progress, and a Cancel run button cancels the run.

If you have a staging environment, try the sync there first by adding --environment staging. The run then uses staging’s secret values and rules, and production stays untouched. See Environments.

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

  • Reminix never retries a long run on its own, 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.