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.
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.
ps -p 12345 -o pid,ppid,user,lstart,stat,commA 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.
kill -TERM 12345SIGTERM 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.
ps -p 12345 -o pid,user,lstart,stat,commNo 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.
