Prompt that protects scheduled jobs from double execution with a lock, a time limit and a rule for missed runs. Paste it into an AI tool of your choice, which then protects scheduled jobs.
Results depend on the tool, the model and what you enter.
Fill in
What you type stays in this browser window. We store and send nothing.
What does the job do?
send invoices or emails
import data
build reports
clean up or delete data
sync with another system
Where does it run?
cron on one server
several servers with the same schedule
container platform with schedules
job queue
serverless schedule
What happened?
duplicate messages or bookings
runs pile up
job hangs and blocks
run missing after a deployment
nothing yet, but unsure
Your prompt
Help me protect a scheduled job so it never runs twice or stops halfway.
Job: [Job]
Setup: [Setup]
Symptom: [Symptom]
Steps: 1. Read the schedule, the job code and the durations of recent runs, and compare the longest run with the gap between two starts. 2. Check whether the job can start on several instances at the same time, for example because every server has the same schedule. 3. Propose a lock that allows only one run, with an expiry so a crashed run does not hold the lock forever. 4. Decide what happens after a missed or aborted run: catch up, skip, or continue from the last progress point. 5. Check whether a duplicate run would cause harm, such as duplicate emails or bookings, and propose how each step can run more than once without changing the result. 6. Name the log lines and alerts that reveal overlaps and hangs.
Output: current state with durations, locking design, rule for missed runs, code proposal and a list of alerts.
Take particular care to make sure every job runs exactly once and a hang blocks nobody.
Before you answer, check: Are all instructions met? If key information is missing or a placeholder in square brackets is still in the text, ask instead of guessing. Mark assumptions as assumptions.
You have edited the prompt. Changes in the fields above no longer overwrite it.
This is an instruction for an AI, not the result itself.
Fill in the fields or tap a suggestion. Leave out names, addresses and other personal data.
Copy the finished prompt into an AI tool of your choice.
Paste the schedule, the job code and a list of recent runs with start, end and result, without real customer data.
Why does this work?
A job that usually takes five minutes will one day take an hour. Without a lock the next run starts alongside it, and customers get the same message twice.
Tips
Test the lock and time limit on a test system first by artificially stretching one run.
Prompt that plans a data backfill in small, resumable batches with clear brakes.
Prompt · Intermediate · about 15 min
You may use our prompts freely, including at work. Please do not republish them as your own collection. We give no warranty for AI results; check them yourself. Terms of use