Nice example of why atomic writes matter. Did you add any extra recovery handling after this happened?
I sent my report script SIGTERM mid-write. Yesterday's output survived intact.
2 Comments
Hanners
•
BashSnippets
•
@[Hanners] Thanks! I think I need to clarify a bit. Tthis was a deliberate test (SIGTERM one second into a run with a sleep planted between rows), not an outage, so there was nothing to recover. The design is the recovery: the worst case is a stale file, never a torn one, and stale is something you can check.
The one thing I'd add is on the consumer side: alert when the output is older than one run interval, e.g. find out.csv -mmin +1500 from a daily cron. The other lesson was the order inside the trap: capture $? first, clean up second, exit with the saved code last. Running rm first was the one variant that exited 0 on a failed run.
Please log in to add a comment.
🔥 Join developers growing publicly
Share your knowledge, build in public, and grow your developer presence with a global community.
Please log in to comment on this post.
More Posts
- © 2026 Coder Legion
- Feedback / Bug
- Privacy
- About Us
- Contacts
- You Tube
- Tiktok
- Premium Subscription
- Terms of Service
- Early Builders
chevron_left
68Posts
31Comments
10Connections
Linux user who got tired of Googling the same bash commands every time I sat down at a terminal. Sta... Show moreLinux user who got tired of Googling the same bash commands every time I sat down at a terminal. Started writing them down. That turned into bashsnippets.xyz -->
a free and growing library of copy-paste bash scripts with plain-English explanations. No logins, no paywalls, just scripts that work. I post a new one every week on YouTube & TikTok @BashSnippets. Show less
a free and growing library of copy-paste bash scripts with plain-English explanations. No logins, no paywalls, just scripts that work. I post a new one every week on YouTube & TikTok @BashSnippets. Show less
More From BashSnippets
Related Jobs
- Music Systems and Reporting AnalystUnknown Company · Full time · United Kingdom
- Full Stack JavaScript Developer (Data & Search Focus)Metric5 · Full time · Saint Louis, MO
- Full Stack Python JavaScript Developer with any Capital MarketsSANS Consulting Services, Inc. · Full time · New York, NY
Commenters (This Week)
Anas Sheikh
2 comments
Isha_Gupta
1 comment
Figsh
1 comment
Contribute meaningful comments to climb the leaderboard and earn badges!