{"id":5094,"date":"2016-09-23T00:45:12","date_gmt":"2016-09-23T00:45:12","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=5094"},"modified":"2016-09-23T00:45:12","modified_gmt":"2016-09-23T00:45:12","slug":"kill-node-processes-matching-pattern","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/kill-node-processes-matching-pattern\/","title":{"rendered":"Kill all node processes matching a pattern"},"content":{"rendered":"<p>If you use Nodemon to run a node application, you may do something like this:<\/p>\n<pre lang=\"javascript\">\nnodemod dist\/lectures.js\n<\/pre>\n<p>This loads a parent process, and a couple child Node processes &#8211; if one child crashes, the parent restarts them. If you kill the children first, they will be restarted.<\/p>\n<p>When you do this, you get a process ID out, which you can use later. However killing this doesn&#8217;t seem to kill the child processes.<\/p>\n<p>Fortunately, you can kill them all at once, like so:<\/p>\n<pre lang=\"bash\">\nkill -9 $(ps -ef | grep lecture[s] | awk '{print $2}')\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Killing many processes matching a pattern from the command line<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4],"tags":[79,387],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/5094"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=5094"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/5094\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=5094"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=5094"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=5094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}