kill
terminate a process.
>kill –signal PID
kill signals that you can send to the process. Here are the most useful of these:
•SIGHUP This is kill signal 1. This signal restarts the process. After a restart, the process will have exactly the same PID that it had before. This is a very useful option for restarting a service for which you’ve made changes in a configuration file.
•SIGINT This is kill signal 2. This signal sends a ctrl-c key sequence to the process.
•SIGKILL This is kill signal 9. This is a brute-force signal that kills the process. If the process was hung badly, this option will force it to stop. However, the process may not clean up after itself if this signal is used. The resources allocated to the process may remain allocated until the system is restarted.
•SIGTERM This is kill signal 15. This signal tells the process to terminate immediately. This is the default signal sent by kill if you omit a signal in the command line. This signal allows the process to clean up after itself before exiting.
If you experience a hung process that needs to be killed, I suggest you use the following sequence:
1.Send a SIGINT first. If it doesn’t respond, then go on to step 2.
2.Send a SIGTERM. Usually, this will fix the problem and allow the process to exit cleanly. If it doesn’t, then go on to step 3.
3.Send a SIGKILL.
No comments:
Post a Comment