{"id":360,"date":"2006-08-15T18:05:15","date_gmt":"2006-08-16T01:05:15","guid":{"rendered":"http:\/\/www.gubatron.com\/blog\/2006\/08\/15\/como-matar-varios-procesos-cuando-killall-no-es-una-opcion\/"},"modified":"2006-08-15T18:05:15","modified_gmt":"2006-08-16T01:05:15","slug":"como-matar-varios-procesos-cuando-killall-no-es-una-opcion","status":"publish","type":"post","link":"https:\/\/www.gubatron.com\/blog\/como-matar-varios-procesos-cuando-killall-no-es-una-opcion\/","title":{"rendered":"Como matar varios procesos cuando killall no es una opcion."},"content":{"rendered":"<p>A veces tienes un cronjob que se queda pegado por mucho rato, cuando haces<br \/>\nCode:<br \/>\nps aux | grep miPrograma<br \/>\ntienes un monton de instancias pegadas!!<\/p>\n<p>Intentas hacer<\/p>\n<p><code>killall miPrograma<\/code><\/p>\n<p>pero no funciona porque quizas es un programa que estas arrancando con un interprete, como python, o php, o perl.<\/p>\n<p>Ni de vaina puedes hacer<\/p>\n<p><code>killall php<\/code><\/p>\n<p>porque hay otros procesos por ahi que necesitas corriendo&#8230; que haces?<\/p>\n<p><code>ps aux | egrep miPrograma | awk {'print $2'} | xargs kill -KILL<\/code><\/p>\n<p>Esta es la explicacion de los comandos utilizados.<\/p>\n<p>ps aux, lista los procesos<br \/>\negrep, filtra aquellos procesos que te intersan<br \/>\nawk {&#8216;print $2&#8217;}, imprime la segunda columna del proceso listado, es decir el PID<br \/>\nxargs kill -KILL, agarra la salida de awk, y la pasa como parametro a kill<\/p>\n<p>Puedes poner esto en un script bash o en un alias, y tener tu propio myKillall <programa>, y perro a cagar.<\/p>\n<p>Viva Linux.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A veces tienes un cronjob que se queda pegado por mucho rato, cuando haces Code: ps aux | grep miPrograma tienes un monton de instancias pegadas!! Intentas hacer killall miPrograma pero no funciona porque quizas es un programa que estas arrancando con un interprete, como python, o php, o perl. Ni de vaina puedes hacer [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[30,43],"tags":[],"class_list":["post-360","post","type-post","status-publish","format-standard","hentry","category-geeklife","category-linux"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5Unzf-5O","jetpack-related-posts":[{"id":507,"url":"https:\/\/www.gubatron.com\/blog\/como-saber-que-programa-esta-ocupando-tus-recursos-de-sonido-como-matar-varios-procesos-relacionados-sin-hacer-kill-9-a-mano\/","url_meta":{"origin":360,"position":0},"title":"Como saber que programa esta ocupando tus recursos de sonido. Como matar varios procesos relacionados sin hacer kill -9 a mano","author":"gubatron","date":"April 23, 2007","format":false,"excerpt":"Aprovecho y doy 2 consejos. Cuando Amarok, o XMMS no te quieren funcionar, y no ves ningun proceso que este relacionado en top, matas todo... firefox, xmms, amarok, y aun nada.... la solucion es lsof. Intenta hacer esto: lsof | grep alsa Aparecera una lista de procesos y te muestra\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":130,"url":"https:\/\/www.gubatron.com\/blog\/linux-poder-de-bash-grep-awk\/","url_meta":{"origin":360,"position":1},"title":"Linux: Poder de Bash, Grep, AWK","author":"gubatron","date":"April 3, 2005","format":false,"excerpt":"Si eres un pipiri en linux, te vas a aburrir con esto. Ya con 2 meses o quizas un poco mas de vivir 100% linux, empiezo a probar por mi mismo cosas que recuerdo haber visto en los .bash_history de la cuenta del administrador en mi universidad, ya hace mas\u2026","rel":"","context":"In &quot;Gubatron&quot;","block_context":{"text":"Gubatron","link":"https:\/\/www.gubatron.com\/blog\/category\/gubatron\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":513,"url":"https:\/\/www.gubatron.com\/blog\/bash-alias-svn_diff_counter-count-lines-added-and-removed\/","url_meta":{"origin":360,"position":2},"title":"Bash Alias &#8211; &#8220;svn_diff_counter&#8221;: Count lines added and removed","author":"gubatron","date":"April 30, 2007","format":false,"excerpt":"I love to know how many lines I've added and deleted before making a commit. This is why I created this alias: alias svn_diff_counter='svn diff | egrep \"^[+|-].*\" | egrep -v \"(+++)|(---)\" > .tmp_diff_counter ; added=`egrep \"(^+)\" .tmp_diff_counter | wc -l`; removed=`egrep \"(^-)\" .tmp_diff_counter | wc -l`; rm .tmp_diff_counter; echo\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2202,"url":"https:\/\/www.gubatron.com\/blog\/have-the-latest-haproxy-as-a-ubuntu-service\/","url_meta":{"origin":360,"position":3},"title":"Have the latest HAProxy as a Ubuntu Service","author":"gubatron","date":"April 6, 2011","format":false,"excerpt":"So you need to use HAProxy and you love the convenience of binary packages on repos, but when you install the version HAProxy available in the repos you realize that it is way too old for what you need. Then you download the latest HAProxy, compile it, configure it, but\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":570,"url":"https:\/\/www.gubatron.com\/blog\/check-if-your-phps-diff-syntax-isnt-breaking\/","url_meta":{"origin":360,"position":4},"title":"Check if your PHP&#8217;s diff syntax isn&#8217;t breaking","author":"gubatron","date":"August 11, 2007","format":false,"excerpt":"Say you're working on emacs, without any kind of syntax checking, and you don't want to commit your code cause you might have syntax errors. If you're smart, the best way to know what files you actually changed, is using svn diff | grep +++ (that is, if you're using\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1457,"url":"https:\/\/www.gubatron.com\/blog\/map-commands-to-servers-via-ssh\/","url_meta":{"origin":360,"position":5},"title":"Quick N Dirty way to Map Commands to remote servers via ssh","author":"gubatron","date":"October 10, 2009","format":false,"excerpt":"You may be running several independent but similar servers at the same time and wasting time by executing commands in all of them one by one. Wouldn't it be nice to send a command to all of them at once? or to monitor all of them at once. The following\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/posts\/360","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/comments?post=360"}],"version-history":[{"count":0,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/posts\/360\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/media?parent=360"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/categories?post=360"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/tags?post=360"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}