The Cleanup Script Exited 0 and Reported Success — Then Scaling Blew Up Three Days Later: 7 Shell Safety Audits to Run Before Any Script Goes to Production

Overview Start with the conclusion: an exit code of 0 does not mean the script behaved. That sounds obvious, yet every year it burns someone in a production environment in a slightly different way. Last year, on an e-commerce order fulfillment system, I hit this: a cleanup script that ran every night at 1 a.m. and pruned old release directories under /data/apps/order-api/releases/. It had run for two years with nothing but a clean clean done in the log....

November 30, 2026 · 24 mins · 4909 words · ABao