Shared server guidance · Question & answer

How do I stop one confirmed Linux process gracefully?

For a managed service, use its service manager so shutdown and restart policies are respected. For a standalone process you own, SIGTERM requests an orderly exit. SIGKILL prevents normal cleanup and should not be the default response to high resource usage or a slow shutdown.

IntermediateLinux VPS and dedicated servers with GNU utilities
Go to the answer

Before you start

  • An authorised SSH session on the Linux server.

Instructions

1. Confirm the process immediately before acting

Replace the sample PID with the actual intended process. Check its owner and start time, and determine whether a service manager will restart it automatically.

Remote Linux shell
ps -p 12345 -o pid,ppid,user,lstart,stat,comm

A PID can be reused after a process exits. Never reuse an old PID from an earlier incident without checking it again.

2. Request a graceful exit only when authorised

This example is for that verified standalone process. Use the application’s supported shutdown mechanism instead if it must drain requests, flush data or coordinate with other nodes.

Remote Linux shell
kill -TERM 12345

SIGTERM allows the process to handle shutdown. Permission failures are not a reason to kill unrelated processes or change ownership.

3. Check the outcome

Allow the documented shutdown time, then inspect the process and the application state again.

Remote Linux shell
ps -p 12345 -o pid,user,lstart,stat,comm

No process entry means that PID is absent at this moment; also verify that the application completed its required cleanup.

Check the result

  • The intended workload stops cleanly, related data remains consistent and unrelated services continue to operate.

Troubleshooting

The process returns with a new PID
A supervisor may be restarting it. Use that supervisor’s supported controls.
The process is in uninterruptible sleep
Investigate blocked I/O; stronger signals may not resolve the underlying device wait.

Official references

Use the documentation for your installed version when a flag, service name or platform feature differs.