bash killer

Bash killer one liners

|

[et_pb_section admin_label=”Section” fullwidth=”on” specialty=”off”][et_pb_fullwidth_post_title admin_label=”Fullwidth Post Title” title=”on” meta=”on” author=”off” date=”on” categories=”on” comments=”off” featured_image=”on” featured_placement=”background” parallax_effect=”off” parallax_method=”on” text_orientation=”center” text_color=”dark” text_background=”on” text_bg_color=”rgba(255,255,255,0.9)” module_bg_color=”rgba(255,255,255,0)” title_all_caps=”off” use_border_color=”off” border_color=”#ffffff” border_style=”solid”]

[/et_pb_fullwidth_post_title][/et_pb_section][et_pb_section admin_label=”section”][et_pb_row admin_label=”row”][et_pb_column type=”4_4″][et_pb_text admin_label=”Text” background_layout=”light” text_orientation=”left” use_border_color=”off” border_color=”#ffffff” border_style=”solid”]

[/et_pb_text][/et_pb_column][/et_pb_row][et_pb_row admin_label=”row”][et_pb_column type=”4_4″][et_pb_text admin_label=”bottom above footer” background_layout=”light” text_orientation=”left” use_border_color=”off” border_color=”#ffffff” border_style=”solid”]

[bsa_pro_ad_space id=5 if_empty=6 hide_for_id=953,680]

[/et_pb_text][et_pb_divider admin_label=”Divider” color=”#ffffff” show_divider=”off” divider_style=”solid” divider_position=”top” hide_on_mobile=”on”]

[/et_pb_divider][et_pb_text admin_label=”Text” background_layout=”light” text_orientation=”left” use_border_color=”off” border_color=”#ffffff” border_style=”solid”]

[jetpack-related-posts]

[/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section][et_pb_section admin_label=”section”][et_pb_row admin_label=”row”][et_pb_column type=”4_4″][et_pb_text admin_label=”Text”]

We sometimes need to find a process and kill it regularly, so why not automate it? well its not exactly straight forward when you automate things. you don’t want to accidentally kill random processes etc. so here’s a nice clean way to find and kill a process a couple of different ways.

First if you have a process id via a pid file (the way lane)

kill $(cat /path/to/PID-file)

now if you don’t have that you can still get it and do this via the process name

kill $(ps aux | grep '[p]rocess name' | awk '{print $2}')

or

kill $(ps aux | awk '/[p]rocess/ {print $2}')

PS the reason for the [] around the first char is so the look up command itself doesn’t show in the list.

[/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section]

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *