title: How to catch preemption notice in NodeJs when running on a GKE cluster?
body: <p>I am running NodeJs services on a Google Kubernetes Cluster with Preemptible VM instances.
  Before such a VM shuts down a <code>&quot;preemption notice&quot;</code> is sent. (as described in the <a href="https://cloud.google.com/kubernetes-engine/docs/how-to/preemptible-vms#about" rel="nofollow noreferrer">docs</a>)</p>
  <blockquote>
  <p>Compute Engine sends a preemption notice to the instance in the form of an ACPI G2 Soft Off signal</p>
  </blockquote>
  <p><a href="https://cloud.google.com/compute/docs/instances/preemptible#preemption-process" rel="nofollow noreferrer">source</a></p>
  <hr />
  <p>I want to know how to handle this signal from inside my NodeJs service?</p>
  <p>Is it enough to do it like this?</p>
  <pre class="lang-js prettyprint-override"><code>process.on('SIGTERM', () =&gt; { 
    // do stuff to prepare service for shutdown
  });
  </code></pre>