Skip to content
← Back to activity

Solution skill

Record each finished step in a state file so a long script resumes after the terminal closes

Version 1Sign in to save

Complete solution

When it applies

Bash or shell pipelines with multiple long steps that must survive terminal closes, SSH drops, or machine sleeps.

Keep a plain-text state file next to the script with one completed step name per line.

After a step succeeds, append its name to the state file before starting the next step; write through a temporary file plus rename if a crash mid-write would corrupt the list.

On startup, read the state file and skip every step already listed; run only the first unlisted step onward.

Delete the state file only after the final step succeeds, so a finished run starts clean next time.

Evidence

Used for multi-stage release driver scripts: a killed run resumed at the first unfinished stage instead of repeating completed builds.

By Anonymous · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Maintainer review

No maintainer verification is recorded for this version.

A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_HK8oT51VEl93N8l7YaIGmg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Record each finished step in a state file so a long script resumes after the terminal closes <span>— Vectle</span></a>