{"id":1366,"date":"2013-09-04T22:37:44","date_gmt":"2013-09-04T14:37:44","guid":{"rendered":"http:\/\/binaryone.com.au\/?p=1366"},"modified":"2023-11-23T07:00:56","modified_gmt":"2023-11-23T07:00:56","slug":"should-you-kill-or-terminate-a-misbehaving-process","status":"publish","type":"post","link":"https:\/\/binaryone.com.au\/23\/should-you-kill-or-terminate-a-misbehaving-process\/","title":{"rendered":"Should you kill or terminate a misbehaving process."},"content":{"rendered":"\n<p>Have you ever had a linux process that was not running but when you try to start or restart the process nothing happens. You may find that you need to kill the process before you try to restart it because the process is actually still alive and not responding or not actually alive but the pid (which is a unique identifying number that tells the kernel that the process has stated or is alive) was not removed when the process ended. So the kernel thinks that the process is working just fine when in fact it is not and won\u2019t start it a new.<\/p>\n\n\n\n<p>Before you kill the process you should always try to terminate it first. Because terminate tries to end the process gracefully and finish writing any remaining data that the process may have stored in memory as well terminate will finish writing any logging data to assist you to find out what caused the process to fail in the first place<\/p>\n\n\n\n<p>The command to terminate a process is<\/p>\n\n\n<div class=\"wp-block-ub-content-toggle wp-block-ub-content-toggle-block\" id=\"ub-content-toggle-block-451086a7-0342-4e8f-9afa-442add12a7d0\" data-mobilecollapse=\"false\" data-desktopcollapse=\"false\" data-preventcollapse=\"false\" data-showonlyone=\"false\">\n<div class=\"wp-block-ub-content-toggle-accordion\" style=\"border-color: #19294e; \" id=\"ub-content-toggle-panel-block-\">\n\t\t\t<div class=\"wp-block-ub-content-toggle-accordion-title-wrap\" style=\"background-color: #19294e;\" aria-controls=\"ub-content-toggle-panel-0-451086a7-0342-4e8f-9afa-442add12a7d0\" tabindex=\"0\">\n\t\t\t<p class=\"wp-block-ub-content-toggle-accordion-title ub-content-toggle-title-451086a7-0342-4e8f-9afa-442add12a7d0\" style=\"color: #f2f2f2; \">Code<\/p>\n\t\t\t<div class=\"wp-block-ub-content-toggle-accordion-toggle-wrap right\" style=\"color: #f2f2f2;\"><span class=\"wp-block-ub-content-toggle-accordion-state-indicator wp-block-ub-chevron-down open\"><\/span><\/div>\n\t\t<\/div>\n\t\t\t<div role=\"region\" aria-expanded=\"true\" class=\"wp-block-ub-content-toggle-accordion-content-wrap\" id=\"ub-content-toggle-panel-0-451086a7-0342-4e8f-9afa-442add12a7d0\">\n\n<p>kill -15 pid<\/p>\n\n<\/div>\n\t\t<\/div>\n<\/div>\n\n\n<p>replace pid with the pid number<\/p>\n\n\n\n<p>If your attempt to terminate the process fails then you will have to use the more powerful kill command which will bypass the process and ask the kernel to kill the misbehaving process directly.<\/p>\n\n\n\n<p>The command to have the kernel kill a process is<\/p>\n\n\n<div class=\"wp-block-ub-content-toggle wp-block-ub-content-toggle-block\" id=\"ub-content-toggle-block-3e39566b-ee01-4a3d-b11a-8068e064a9db\" data-mobilecollapse=\"false\" data-desktopcollapse=\"false\" data-preventcollapse=\"false\" data-showonlyone=\"false\">\n<div class=\"wp-block-ub-content-toggle-accordion\" style=\"border-color: #19294e; \" id=\"ub-content-toggle-panel-block-\">\n\t\t\t<div class=\"wp-block-ub-content-toggle-accordion-title-wrap\" style=\"background-color: #19294e;\" aria-controls=\"ub-content-toggle-panel-0-3e39566b-ee01-4a3d-b11a-8068e064a9db\" tabindex=\"0\">\n\t\t\t<p class=\"wp-block-ub-content-toggle-accordion-title ub-content-toggle-title-3e39566b-ee01-4a3d-b11a-8068e064a9db\" style=\"color: #f2f2f2; \">Code<\/p>\n\t\t\t<div class=\"wp-block-ub-content-toggle-accordion-toggle-wrap right\" style=\"color: #f2f2f2;\"><span class=\"wp-block-ub-content-toggle-accordion-state-indicator wp-block-ub-chevron-down open\"><\/span><\/div>\n\t\t<\/div>\n\t\t\t<div role=\"region\" aria-expanded=\"true\" class=\"wp-block-ub-content-toggle-accordion-content-wrap\" id=\"ub-content-toggle-panel-0-3e39566b-ee01-4a3d-b11a-8068e064a9db\">\n\n<p>kill -9 pid<\/p>\n\n<\/div>\n\t\t<\/div>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p>replace pid with the pid number<\/p>\n\n\n\n<p>Before you can kill the process you will have to find its pid. To find out the pid of a running process in virtualmin you can go to<\/p>\n\n\n\n<p>Webmin&gt; System&gt; Running Processes&gt;<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><a href=\"https:\/\/192.168.0.150\/23\/wp-content\/uploads\/2013\/09\/Running-processes-screen.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"652\" src=\"http:\/\/binaryone.com.au\/12\/wp-content\/uploads\/2013\/09\/Running-processes-screen-1024x652.png\" alt=\"Linux, kill, terminate, kill -15 pid, kill -15, kill -9 pid, kill -9, pid, linux process, process, not running, process not running, start, restart, start or restart, not responding, process not responding, kernel, pid not removed, kill the process, stop the process, terminate the process, end the process, end the process gracefully, writing any logging data, virtualmin, webmin, Running Processes,\" class=\"wp-image-1370\" srcset=\"https:\/\/binaryone.com.au\/23\/wp-content\/uploads\/2013\/09\/Running-processes-screen.png 1024w, https:\/\/binaryone.com.au\/23\/wp-content\/uploads\/2013\/09\/Running-processes-screen-300x191.png 300w, https:\/\/binaryone.com.au\/23\/wp-content\/uploads\/2013\/09\/Running-processes-screen-768x489.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>and select pid from the Display menu then scroll to find the pid of the process you are looking for. Click on the pid of the process you want to kill and you will be taken to a new screen where you can terminate or kill the process by clicking the matching button.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><a href=\"https:\/\/192.168.0.150\/23\/wp-content\/uploads\/2013\/09\/Process-information-screen.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"651\" src=\"http:\/\/binaryone.com.au\/12\/wp-content\/uploads\/2013\/09\/Process-information-screen-1024x651.png\" alt=\"Linux, kill, terminate, kill -15 pid, kill -15, kill -9 pid, kill -9, pid, linux process, process, not running, process not running, start, restart, start or restart, not responding, process not responding, kernel, pid not removed, kill the process, stop the process, terminate the process, end the process, end the process gracefully, writing any logging data, virtualmin, webmin, Running Processes,\" class=\"wp-image-1369\" srcset=\"https:\/\/binaryone.com.au\/23\/wp-content\/uploads\/2013\/09\/Process-information-screen.png 1024w, https:\/\/binaryone.com.au\/23\/wp-content\/uploads\/2013\/09\/Process-information-screen-300x191.png 300w, https:\/\/binaryone.com.au\/23\/wp-content\/uploads\/2013\/09\/Process-information-screen-768x488.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>If you are not a <a href=\"https:\/\/www.virtualmin.com\/\" target=\"_blank\" rel=\"noopener nofollow\" title=\"\">virtualmin<\/a> user you can open a terminal window and type<\/p>\n\n\n<div class=\"wp-block-ub-content-toggle wp-block-ub-content-toggle-block\" id=\"ub-content-toggle-block-a584c7c5-34b4-43ee-9868-050b47395634\" data-mobilecollapse=\"false\" data-desktopcollapse=\"false\" data-preventcollapse=\"false\" data-showonlyone=\"false\">\n<div class=\"wp-block-ub-content-toggle-accordion\" style=\"border-color: #19294e; \" id=\"ub-content-toggle-panel-block-\">\n\t\t\t<div class=\"wp-block-ub-content-toggle-accordion-title-wrap\" style=\"background-color: #19294e;\" aria-controls=\"ub-content-toggle-panel-0-a584c7c5-34b4-43ee-9868-050b47395634\" tabindex=\"0\">\n\t\t\t<p class=\"wp-block-ub-content-toggle-accordion-title ub-content-toggle-title-a584c7c5-34b4-43ee-9868-050b47395634\" style=\"color: #f2f2f2; \">Code<\/p>\n\t\t\t<div class=\"wp-block-ub-content-toggle-accordion-toggle-wrap right\" style=\"color: #f2f2f2;\"><span class=\"wp-block-ub-content-toggle-accordion-state-indicator wp-block-ub-chevron-down open\"><\/span><\/div>\n\t\t<\/div>\n\t\t\t<div role=\"region\" aria-expanded=\"true\" class=\"wp-block-ub-content-toggle-accordion-content-wrap\" id=\"ub-content-toggle-panel-0-a584c7c5-34b4-43ee-9868-050b47395634\">\n\n<p>ps aux | less<\/p>\n\n<\/div>\n\t\t<\/div>\n<\/div>\n\n\n<p>which will give you a list that looks something like<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><a href=\"https:\/\/192.168.0.150\/23\/wp-content\/uploads\/2013\/09\/terminal-window-pid-process.png\"><img loading=\"lazy\" decoding=\"async\" width=\"923\" height=\"366\" src=\"https:\/\/192.168.0.150\/23\/wp-content\/uploads\/2013\/09\/terminal-window-pid-process.png\" alt=\"Linux, kill, terminate, kill -15 pid, kill -15, kill -9 pid, kill -9, pid, linux process, process, not running, process not running, start, restart, start or restart, not responding, process not responding, kernel, pid not removed, kill the process, stop the process, terminate the process, end the process, end the process gracefully, writing any logging data, virtualmin, webmin, Running Processes,\" class=\"wp-image-1371\" srcset=\"https:\/\/binaryone.com.au\/23\/wp-content\/uploads\/2013\/09\/terminal-window-pid-process.png 923w, https:\/\/binaryone.com.au\/23\/wp-content\/uploads\/2013\/09\/terminal-window-pid-process-300x119.png 300w, https:\/\/binaryone.com.au\/23\/wp-content\/uploads\/2013\/09\/terminal-window-pid-process-768x305.png 768w\" sizes=\"auto, (max-width: 923px) 100vw, 923px\" \/><\/a><\/figure>\n\n\n\n<p>when you have the pid you need to kill the process. As mentioned above you should always try the terminate command first. In the terminal window type<\/p>\n\n\n<div class=\"wp-block-ub-content-toggle wp-block-ub-content-toggle-block\" id=\"ub-content-toggle-block-4857d9e7-509c-41d3-b9c9-38ffdaef1710\" data-mobilecollapse=\"false\" data-desktopcollapse=\"false\" data-preventcollapse=\"false\" data-showonlyone=\"false\">\n<div class=\"wp-block-ub-content-toggle-accordion\" style=\"border-color: #19294e; \" id=\"ub-content-toggle-panel-block-\">\n\t\t\t<div class=\"wp-block-ub-content-toggle-accordion-title-wrap\" style=\"background-color: #19294e;\" aria-controls=\"ub-content-toggle-panel-0-4857d9e7-509c-41d3-b9c9-38ffdaef1710\" tabindex=\"0\">\n\t\t\t<p class=\"wp-block-ub-content-toggle-accordion-title ub-content-toggle-title-4857d9e7-509c-41d3-b9c9-38ffdaef1710\" style=\"color: #f2f2f2; \">Code<\/p>\n\t\t\t<div class=\"wp-block-ub-content-toggle-accordion-toggle-wrap right\" style=\"color: #f2f2f2;\"><span class=\"wp-block-ub-content-toggle-accordion-state-indicator wp-block-ub-chevron-down open\"><\/span><\/div>\n\t\t<\/div>\n\t\t\t<div role=\"region\" aria-expanded=\"true\" class=\"wp-block-ub-content-toggle-accordion-content-wrap\" id=\"ub-content-toggle-panel-0-4857d9e7-509c-41d3-b9c9-38ffdaef1710\">\n\n<p>kill -15 pid<\/p>\n\n<\/div>\n\t\t<\/div>\n<\/div>\n\n\n<p>replace pid with the pid number<\/p>\n\n\n\n<p>If the process does not terminate you will the need to use the more powerful kill command<\/p>\n\n\n<div class=\"wp-block-ub-content-toggle wp-block-ub-content-toggle-block\" id=\"ub-content-toggle-block-bf5144c3-5a2a-4702-9727-87dd9d9c3d89\" data-mobilecollapse=\"false\" data-desktopcollapse=\"false\" data-preventcollapse=\"false\" data-showonlyone=\"false\">\n<div class=\"wp-block-ub-content-toggle-accordion\" style=\"border-color: #19294e; \" id=\"ub-content-toggle-panel-block-\">\n\t\t\t<div class=\"wp-block-ub-content-toggle-accordion-title-wrap\" style=\"background-color: #19294e;\" aria-controls=\"ub-content-toggle-panel-0-bf5144c3-5a2a-4702-9727-87dd9d9c3d89\" tabindex=\"0\">\n\t\t\t<p class=\"wp-block-ub-content-toggle-accordion-title ub-content-toggle-title-bf5144c3-5a2a-4702-9727-87dd9d9c3d89\" style=\"color: #f2f2f2; \">Code<\/p>\n\t\t\t<div class=\"wp-block-ub-content-toggle-accordion-toggle-wrap right\" style=\"color: #f2f2f2;\"><span class=\"wp-block-ub-content-toggle-accordion-state-indicator wp-block-ub-chevron-down open\"><\/span><\/div>\n\t\t<\/div>\n\t\t\t<div role=\"region\" aria-expanded=\"true\" class=\"wp-block-ub-content-toggle-accordion-content-wrap\" id=\"ub-content-toggle-panel-0-bf5144c3-5a2a-4702-9727-87dd9d9c3d89\">\n\n<p>kill -9 pid<\/p>\n\n<\/div>\n\t\t<\/div>\n<\/div>\n\n\n<p>replace pid with the pid number<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever had a linux process that was not running but when you try to start or restart the process nothing happens. You may find that you need to kill the process before you try to restart it because the process is actually still alive and not responding or not actually alive but the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[44,206,16],"tags":[197,198,199,200,201,202,203,204,205,47,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,19,20,222],"class_list":["post-1366","post","type-post","status-publish","format-standard","hentry","category-how-to","category-linux-2","category-tutorials","tag-end-the-process","tag-end-the-process-gracefully","tag-kernel","tag-kill","tag-kill-15","tag-kill-15-pid","tag-kill-9","tag-kill-9-pid","tag-kill-the-process","tag-linux","tag-linux-process","tag-not-responding","tag-not-running","tag-pid","tag-pid-not-removed","tag-process","tag-process-not-responding","tag-process-not-running","tag-restart","tag-running-processes","tag-start","tag-start-or-restart","tag-stop-the-process","tag-terminate","tag-terminate-the-process","tag-virtualmin","tag-webmin","tag-writing-any-logging-data"],"aioseo_notices":[],"featured_image_src":null,"author_info":{"display_name":"Allan","author_link":"https:\/\/binaryone.com.au\/23\/author\/allan-cheesman-binaryone\/"},"_links":{"self":[{"href":"https:\/\/binaryone.com.au\/23\/wp-json\/wp\/v2\/posts\/1366","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/binaryone.com.au\/23\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/binaryone.com.au\/23\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/binaryone.com.au\/23\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/binaryone.com.au\/23\/wp-json\/wp\/v2\/comments?post=1366"}],"version-history":[{"count":8,"href":"https:\/\/binaryone.com.au\/23\/wp-json\/wp\/v2\/posts\/1366\/revisions"}],"predecessor-version":[{"id":2452,"href":"https:\/\/binaryone.com.au\/23\/wp-json\/wp\/v2\/posts\/1366\/revisions\/2452"}],"wp:attachment":[{"href":"https:\/\/binaryone.com.au\/23\/wp-json\/wp\/v2\/media?parent=1366"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/binaryone.com.au\/23\/wp-json\/wp\/v2\/categories?post=1366"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/binaryone.com.au\/23\/wp-json\/wp\/v2\/tags?post=1366"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}