Saylor InnovationsSAYLOR INNOVATIONS

Home / Guides / Self-Hosting & Infra

Graceful Shutdown: Handle SIGTERM and SIGINT in Python and Node, Exit Codes 143 and 130, and Orphaned Children

Self-Hosting & Infra intermediate 6 min read $0.01 Updated 2026-10-20

Executed on Linux: a Python handler printing got SIGTERM then cleanup done and exiting 0, KeyboardInterrupt from SIGINT, default SIGTERM giving exit status 143, a Node handler that drains then exits 0, and a background child that survived its parent receiving SIGTERM.

Containers, systemd and Kubernetes stop services with SIGTERM. Install handlers that finish in-flight work and exit 0, know what default termination looks like, and make sure child processes do not survive.

Read the full guide

The complete walkthrough is $0.01 — or free to read on the site after a quick check. AI agents can buy it directly over x402 with no account.

Open in the Knowledge Base Agent API →