github.com/ncodes/nomad@v0.5.7-0.20170403112158-97adf4a74fb3/website/source/docs/operating-a-job/update-strategies/handling-signals.html.md (about)

     1  ---
     2  layout: "docs"
     3  page_title: "Handling Signals - Operating a Job"
     4  sidebar_current: "docs-operating-a-job-updating-handling-signals"
     5  description: |-
     6    Well-behaved applications expose a way to perform cleanup prior to exiting.
     7    Nomad can optionally send a configurable signal to applications before
     8    killing them, allowing them to drain connections or gracefully terminate.
     9  ---
    10  
    11  # Handling Signals
    12  
    13  On operating systems that support signals, Nomad will send the application a
    14  configurable signal before killing it. This gives the application time to
    15  gracefully drain connections and conduct other cleanup before shutting down.
    16  Certain applications take longer to drain than others, and thus Nomad allows
    17  specifying the amount of time to wait for the application to exit before
    18  force-killing it.
    19  
    20  Before Nomad terminates an application, it will send the `SIGINT` signal to the
    21  process. Processes running under Nomad should respond to this signal to
    22  gracefully drain connections. After a configurable timeout, the application wil
    23  be force-terminated.
    24  
    25  ```hcl
    26  job "docs" {
    27    group "example" {
    28      task "server" {
    29        # ...
    30        kill_timeout = "45s"
    31      }
    32    }
    33  }
    34  ```
    35  
    36  For more detail on the `kill_timeout` option, please see the
    37  [job specification documentation](/docs/job-specification/task.html#kill_timeout).