SIGINT
The interrupt signal, sent to the foreground program when you press Control C, asking it to stop.
In more detail
Programs usually exit when they receive it, and a command ended by it reports exit status 130 (128 + 2). A script can trap INT to clean up before leaving.
Examples
trap 'echo interrupted; exit 130' INTIn Node.js, process.on("SIGINT", handler) replaces the default exit, so the handler must end the process itself once cleanup is done.Related terms
- signal — A short notification the kernel delivers to a process, such as please stop or stop now.
- trap builtin — The builtin that runs a command or function when the shell receives a signal or exits, used for cleanup.
- SIGTERM — The signal that politely asks a process to finish its work and exit.
- graceful shutdown — Stopping a service in an orderly way: finish current work, close connections, then exit.
Taught in
- Exit Codes, And What Success Means — Bash Scripting & Command Line Automation
- trap, Cleanup And Temporary Files — Bash Scripting & Command Line Automation
- Processes, Jobs And Signals — Bash Scripting & Command Line Automation
- Close Phase & Signal Dispatch: Sockets & Teardown — Node.js Internals & Backend Services
- Production Hardening: Graceful Shutdown & Docker — Node.js Internals & Backend Services
- Runlevels, Targets And A Polite Shutdown — LPIC-1 Linux Administrator (101-500 and 102-500) Exam Prep