Skip to content
WebsiteHosting.com

concept Linux & administration

Linux signals and graceful process shutdown

SIGTERM can be handled to allow an orderly shutdown. SIGKILL cannot be caught, blocked or ignored; neither signal choice proves that work was saved or termination completed.

Latest recorded source check · P0058

What it means

A signal is a notification to a process. A handler is application code arranged to respond to a catchable signal, and the signal’s disposition is the response selected for it. “Graceful shutdown” describes what the application does—such as completing required work before exiting—not a property that the name SIGTERM guarantees.

Try it

Simulation: start with Signal = SIGTERM and Process installs a TERM handler? = yes. Change only Signal to SIGKILL, then inspect the result and its explanation. Use Compare with baseline to place the current result beside the documented starting result. No process is signaled. Without JavaScript, the initial example remains readable, but the controls do not operate.

Compare process termination signals

Change one condition and inspect the computed result, its cause, and the model boundary.

Simulation

No process is signaled. TERM is assumed unblocked and not ignored; real handlers, cleanup and delivery timing vary.

Application can handle TERM

A catchable SIGTERM may allow cleanup but does not promise its completion.

Compare process termination signals: supplied inputs
InputSupplied value
SignalSIGTERM
Process installs a TERM handler?yes
Compare process termination signals: synthetic inputs

Synthetic local learning example. No account, real network, server, filesystem, credential, command or production change is accessed.

About this model

No process is signaled. TERM is assumed unblocked and not ignored; real handlers, cleanup and delivery timing vary.

These are bounded teaching rules. Actual behavior needs the linked subject specifications and independent observations. The examples are not live checks.

The starting result is “Application can handle TERM.” Its explanation is: “A catchable SIGTERM may allow cleanup but does not promise its completion.” The result describes an available handling path, not completed cleanup.

Keep Process installs a TERM handler? = yes for the first comparison. The scene’s unblocked, non-ignored TERM assumption remains fixed; there is no delivery-time control.

Reset restores Signal = SIGTERM and Process installs a TERM handler? = yes, removes input errors and clears the comparison. It leaves your independently opened or closed FAQ answers and About this model disclosure unchanged.

How it works

A signal’s disposition determines whether the process uses a handler, ignores the signal or follows its default action. A signal mask can also block delivery of signals that permit blocking. The scene deliberately fixes TERM as unblocked and not ignored so you can isolate the effect of the handler selection.

With SIGTERM and a TERM handler installed, the application has a handling path available. That is the intermediate condition behind “Application can handle TERM.” The model does not execute a handler or evaluate its success, so it cannot turn that opportunity into a cleanup-completed result.

Keep SIGTERM selected and change Process installs a TERM handler? to no. The result is “Default termination behavior may apply.” Under the exercise’s unblocked, non-ignored TERM assumption, the process without a TERM handler has the default termination disposition. This branch is not a prediction of termination timing.

SIGKILL removes the application-handler path altogether: it cannot be caught, blocked or ignored. The important contrast is application participation versus forced termination—not safe versus instant. An installed TERM handler changes the SIGTERM branch but has no effect on the SIGKILL branch.

Worked example

This is a synthetic example, not a captured shutdown.

InputBaseline value
SignalSIGTERM
Process installs a TERM handler?yes

The calculated result is “Application can handle TERM.” The explanation is: “A catchable SIGTERM may allow cleanup but does not promise its completion.” With TERM assumed unblocked and not ignored, the installed handler makes application participation possible. No intermediate state in this model says that files were saved or that the process exited.

What changes when the condition changes

Change Signal to SIGKILL while keeping Process installs a TERM handler? = yes. The result becomes “Cannot catch this termination signal.” The explanation is: “SIGKILL cannot be caught or ignored; the process does not run its TERM handler.” The handler remains installed in the example, but it cannot intercept SIGKILL. Changing the handler selection to no would not change this result: the selected signal rules out that application cleanup path.

In practice

Use this distinction to evaluate a shutdown plan, not as instructions to signal a running process. For a Linux service you are authorized to administer, begin with a read-only preflight: identify the supervisor, confirm the intended workload and current process identity, and consult the application’s documented shutdown behavior. Record the current state and the exact workload the plan would affect.

Define the expected observation before considering a change: what would show that the intended workload stopped, and what separate evidence would show that required application work completed? A signal-sending result cannot answer both questions.

STOP if the target, authority, shutdown behavior or recovery plan is unclear. If an observed shutdown differs from the documented expectation, inspect process and supervisor state rather than escalating blindly. Any real stop or forced interruption needs a service-specific procedure, verification criteria and a recovery plan for partially completed work. Restarting a process is not proof that its data is consistent. This page provides no mutating commands or universal TERM-to-KILL sequence.

Limits and unknowns

No process is signaled, and no machine, account, filesystem or service is inspected. The selections describe a synthetic situation; they do not establish that a real process received a signal, ran a handler, exited or saved its work. Those outcomes remain unknown without observations from the actual environment.

TERM is assumed unblocked and not ignored. The scene does not model blocking, explicit ignoring, handler implementation, delivery delays, shutdown duration or supervisor recovery. In particular, “cannot catch” is not a measured promise of instant completion.

If input validation reports an error, no calculated outcome applies until you correct the input or use Reset. A valid categorical result must not be read as proof of a real shutdown.

What to carry forward

Separate the opportunity to run cleanup from evidence that cleanup completed. Choose a shutdown approach from the workload’s documented behavior, then judge the outcome from the resulting service and application state—not from the signal’s name or an attempted send.

Frequently asked questions

Editorial questions, answered from the sources listed for this article.

Does receiving SIGTERM guarantee that files were saved?

No. Receiving SIGTERM does not prove that a handler ran successfully or finished saving files. A saved-work conclusion needs application-specific evidence that the relevant save operations completed; the presence of a TERM handler is not that evidence.

Can an application install a SIGKILL cleanup handler?

No. SIGKILL cannot be caught, blocked or ignored by the process. Installing a TERM handler—or writing another application cleanup handler—does not create a way to intercept SIGKILL.

Does having no TERM handler always mean immediate termination?

No. The signal’s disposition and mask still matter: a process may explicitly ignore TERM or block its delivery. This scene excludes those conditions. With SIGTERM and no handler selected, it assumes unblocked, non-ignored TERM and applies the default termination disposition; it does not calculate when termination completes.

Does sending a signal prove the intended workload stopped?

No. Even a successful signal-sending result is not an application-completion report. Verify the intended target, the resulting process and service state, and any relevant supervisor behavior. An attempted send alone does not establish that the intended workload stopped.

Sources & model boundaries

Primary references used for this explanation. The interactive example is an educational model, not a live check.

  1. Linux signal(7)

    Signal dispositions, masks and standard signals. TERM can be handled; KILL cannot be caught, blocked or ignored

    Checked .

  2. Linux kill(2)

    DESCRIPTION, permissions and return values. Signal targeting and sending are not application-completion evidence

    Checked .