The Job That Ran Twice: Find and Retire Duplicate Schedulers on Your Agent Box

You rebuilt the job. The new version runs on a better schedule, writes better output, and reports when it fails. You tested it, watched it succeed, and moved on.

A week later you notice the output is doubled. Two reports in the inbox. Two posts on the blog. Two invoices drafted for the same client. The new job is fine. The old one never stopped.

This is one of the quietest failures on a self-hosted agent box, because nothing breaks. Both jobs succeed. Both log “ok”. The only symptom is that the work happens twice, and you usually find it from the outside, when someone asks why there are two of something.

We hit exactly this on MarketMai’s own pipeline. The daily blog post moved from an agent cron job on a home Raspberry Pi to a new scheduled writer. The new writer published around 7:30 a.m. The old Pi job, still enabled, published its own post around 8 a.m. For several mornings the site got two posts a day, and the second one came from the old prompt we had meant to replace. Nothing alerted, because from each job’s point of view, it did its job.

Here is how to find duplicates like that and retire the old copy safely.

Why the old job survives

Moving a job almost never deletes the old one, for a few ordinary reasons:

  • The old scheduler lives somewhere else. You built the new job in a different tool, on a different machine, or in CI. Nothing about creating it touches the old schedule.
  • Disabling felt risky. While the new job was unproven, you left the old one on as a fallback and meant to come back to it.
  • Access is awkward. The old job is on a box that needs an SSH session, a VPN, or someone’s approval to reach, so cleanup slips to “later”.
  • It looks healthy. A job that keeps succeeding never shows up in the list of things to fix.

The pattern is common enough that it is worth assuming every migrated job has a twin until you have proven it doesn’t.

Step 1: List every place a job can be scheduled

A typical home agent setup has more schedulers than people remember. Check all of them, not just the one you use most:

# Your user's crontab, and root's
crontab -l
sudo crontab -l

# System-wide cron
ls /etc/cron.d/ /etc/cron.daily/ /etc/cron.hourly/
cat /etc/crontab

# systemd timers, including user timers
systemctl list-timers --all
systemctl --user list-timers --all

# The agent runtime's own scheduler (OpenClaw example)
openclaw cron list

Then look off the box:

  • CI schedules. In GitHub Actions, search the repo for schedule: under .github/workflows/. A workflow with a cron: line runs whether or not anyone pushes.
  • Hosted automation. Zapier, IFTTT, Make, n8n cloud, and similar tools each keep their own list of scheduled triggers.
  • Other agents. If you run more than one assistant, check each one’s routines. Two agents can easily end up owning the same job.
  • Containers. A container with its own cron inside it does not show up in the host’s crontab.

Write the result down as a plain table: what the job does, where it is scheduled, when it fires, and what it writes. That table is the whole audit. Most duplicates become obvious once the rows sit next to each other.

Step 2: Match jobs by what they write, not what they’re called

Duplicates rarely share a name. The old one is “Daily Blog Post” and the new one is “marketing publish”. Match on effects instead:

  • Same destination. Two jobs that push to the same Git branch, post to the same channel, write to the same folder, or call the same API endpoint.
  • Same time window. Two jobs that fire within an hour of each other every day, especially if one used to fire at the other’s time.
  • Same output shape. Two sets of output with the same file naming or the same title pattern.

The fastest check is often the destination’s own history. For a Git-backed site:

git log --since="7 days ago" --format='%h %ad %an %s' --date=format:'%Y-%m-%d %H:%M'

If you see two commits of the same type every day, a few minutes or an hour apart, you have two writers. The author name and the commit time usually tell you which scheduler each one came from.

For a chat channel or an inbox, scroll back a week and look for pairs. For a folder, sort by modified time and look for files arriving in twos.

Step 3: Decide which copy is the real one

Before you turn anything off, be explicit about which job you are keeping and why. Write one line for each duplicate:

  • Which job is the owner from now on.
  • What it does that the other one doesn’t, such as better error reporting, a newer prompt, or a safer commit step.
  • Anything the old job did that the new one doesn’t yet. This is the step people skip. Sometimes the old job also rotated a log, refreshed a token, or pinged a health check, and turning it off silently removes that side effect.

If the old job has a side effect you still need, move that piece into the new job first, then retire the old one. Don’t keep a whole duplicate running just to preserve one small task.

Step 4: Disable first, delete later

Retire the old job in two stages.

Disable it, don’t delete it. Most schedulers have a disable or pause option that keeps the definition around:

# OpenClaw
openclaw cron disable <job-id>

# systemd timer
sudo systemctl disable --now old-publish.timer

# crontab: comment the line out with a dated note
# DISABLED 2026-11-04, replaced by new publisher. Delete after 2026-11-18.
# 0 8 * * * /srv/agent/old-publish.sh

For a CI workflow, remove the schedule: block but leave workflow_dispatch: so you can still run it by hand if you need it.

Confirm it is really off. List the schedule again and check that the job shows as disabled. Then wait for its usual fire time and confirm nothing new arrived from it. One clean morning is the proof, not the command’s exit code.

Delete it after two weeks. Once the new job has run cleanly for a couple of weeks with no gaps, delete the old definition and its script. Leaving disabled jobs around forever just recreates the confusion for the next migration.

Step 5: Make the next duplicate impossible to miss

Retiring today’s twin is the easy part. The longer-term fix is making duplicates visible when they happen.

Give every job one owner record. Keep a single file, for example jobs.md in the agent’s config repo, with one row per scheduled job: what it does, where it runs, when, and what it writes. Update it in the same change that adds or moves a job. If a job isn’t in the file, it shouldn’t be running.

Guard the destination. Make the job check before it writes. A publishing job can stop if a post with today’s date already exists. A report job can stop if today’s report file is already there. This turns a second writer into a harmless no-op instead of a duplicate:

TODAY=$(TZ=America/Chicago date +%F)
if grep -rlq "pubDate: $TODAY" src/content/blog/; then
  echo "Post for $TODAY already exists, skipping."
  exit 0
fi

That one check would have kept our site to one post a day even while both jobs were running.

Tag the output. Have each job stamp its output with its own name, such as a commit trailer, a footer line, or a log prefix. When two copies appear, you can tell at a glance which scheduler made each one.

Count, don’t just check success. A daily health check that asks “did today’s job succeed?” will pass with two jobs running. Ask “how many did we produce today?” and alert on anything other than one.

A migration checklist you can reuse

Every time you move a scheduled job somewhere new:

  1. Write down where the old job is scheduled before you build the new one.
  2. Add a guard to the new job so it skips if today’s output already exists.
  3. Run the new job by hand once and check the output.
  4. Disable the old job the same day the new one goes live, not “after it proves itself”.
  5. Watch one full cycle and confirm exactly one output arrived.
  6. Update your jobs file.
  7. Delete the old definition two weeks later.

If you want a fallback while the new job is unproven, make the fallback manual: keep the old job runnable by hand, not on a timer.

The short version

Moving a job doesn’t stop the old one. List every scheduler on the box and off it, match jobs by what they write, pick an owner, disable the old copy, and confirm with one clean cycle before you delete anything. Then add a guard and a count so the next duplicate shows up the first morning instead of the seventh.

Let your agent run the sweep

This is a good audit to hand to your agent once you’ve done it by hand. Start with MarketMai’s free AI prompt pack and adapt one into a “list every scheduled job on this box and in this repo, group them by what they write, and flag any pair that writes to the same place” task, then review its table before you disable anything. For production cron configs, runbooks, and monitoring checks built for self-hosted agents, the OpenClaw Agent Ops Toolkit has the full set, and the MarketMai Ultimate Bundle puts 13 prompt, automation, and agent-operations products in one $49 download.

More from the build log

Suggested

Want the full MarketMai stack?

Get the core MarketMai guides and operator playbooks in one premium bundle for $49.

View Bundle