# Listen for SIGINT and SIGTERM Events in a ZX Script

DevFeed: [Listen for SIGINT and SIGTERM Events in a ZX Script](<https://devfeed.tech/articles/listen-for-sigint-and-sigterm-events-in-a-zx-script-21823.md>)

Original publisher: [Read original article](<https://www.thepolyglotdeveloper.com/blog/2023/01/listen-sigint-sigterm-events-zx-script/>)

Author: Nic Raboy

Published: 2023-01-06T21:00:00Z

Content type: tutorial

Language: en

Sources: [Nic Raboy](<https://devfeed.tech/sources/nic-raboy.md>)

Topics: [Script](<https://devfeed.tech/topics/script.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [Node.js](<https://devfeed.tech/topics/node-js.md>), [Unix](<https://devfeed.tech/topics/unix.md>), [Linux](<https://devfeed.tech/topics/linux.md>), [Command-line interface](<https://devfeed.tech/topics/cli.md>), [Process](<https://devfeed.tech/topics/process.md>)

Tags: [bash](<https://devfeed.tech/tags/bash.md>), [cleanup](<https://devfeed.tech/tags/cleanup.md>), [command-line](<https://devfeed.tech/tags/command-line.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [linux](<https://devfeed.tech/tags/linux.md>), [node-js](<https://devfeed.tech/tags/node-js.md>), [process](<https://devfeed.tech/tags/process.md>), [script](<https://devfeed.tech/tags/script.md>), [signal](<https://devfeed.tech/tags/signal.md>), [unix](<https://devfeed.tech/tags/unix.md>), [zx](<https://devfeed.tech/tags/zx.md>)

## AI overview

A tutorial on handling SIGINT and SIGTERM events in ZX scripts with JavaScript. It covers prerequisites, a simple long-running script, and graceful shutdown and cleanup logic on Unix-like systems.

## Source excerpt

Have you ever needed to handle signal events within your ZX script? For example, what happens if you need to handle a graceful shutdown of your long-running or infinite-running script? Or what happens... The post Listen for SIGINT and SIGTERM Events in a ZX Script appeared first on The Polyglot Developer.