#StackBounty: #job-control #jobs "kill %{job id}" vs "kill {job pid}"

Bounty: 50

I’m working with some tail -f path/to/my/log/file | grep pattern& and I need to kill the process as quick as possible.
With classic kill {tail PID}, tail still displays its buffer and it takes around 12 second (on my setup) to get tail completely silent.

However, it’s much faster when I kill it with kill %{job id} (slightly more than a second).

How is it different to call kill {tail PID} and kill %{job id}?

Some samples :

01/09/2021 15:45:29:670:killall tail
01/09/2021 15:45:39:232: {some log}
01/09/2021 15:45:39:232: {some log}
01/09/2021 15:45:39:232: {last log line}  
takes around 10 seconds to fully shutdown

with kill %{job id} :

01/09/2021 10:56:57:793 -> (COM12<):kill %1;kill %2
01/09/2021 10:56:58:966 -> (COM12>):[root@my_board ~]# 
takes 1 sec to fully shutdown

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.