On 10/20/2015 04:21 AM, Mike Miller wrote:
> On Mon, 19 Oct 2015, rhubarbpieguy at gmail.com wrote:
>
>> On 10/17/2015 09:52 AM, rhubarbpieguy at gmail.com wrote:
>>>
>>> I'm unable to kill Script2Kill.sh using "pkill Script."  Using jobs 
>>> I see:
>>>
>>>    [1]+  Running            ./Script2Kill.sh &
>>>
>>> I can kill the script with "kill %1" but "pkill Script" has no 
>>> effect. I've tried several combinations, but if I understand 
>>> correctly, pkill and part of the name string should work.  Can 
>>> others use pkill successfully?
>>
>> The responses correctly point to the problem.  I'm interested in 
>> killing the script by name.  I can get the script name with the jobs 
>> command as I run it in the background.  However, I apparently can't 
>> kill a script running in the background by name; only a process by name.
>>
>> It's not difficult to find the script(s) by name and then kill them 
>> with a script.  I hoped for some obscure command to so, but worse 
>> things have happened.
>
>
> What am I doing differently from you?  Here I make a script, execute 
> it, then kill it using pkill, which works:
>
>
> $ cat > nonsensical.bash
> #!/bin/bash
>
> for I in {1..100} ; do echo "a" > /dev/null ; sleep 10 ; done
> ^D
>
> $ chmod 755 nonsensical.bash
>
> $ ./nonsensical.bash &
> [6] 12253
>
> $ pkill nonsensical
> [6]-  Terminated              ./nonsensical.bash
>
>
> Best,
> Mike
> _______________________________________________
> TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
> tclug-list at mn-linux.org
> http://mailman.mn-linux.org/mailman/listinfo/tclug-list
>
Golly, I don't know.  Your script is a good test but pkill doesn't kill 
it on my box.  Man lists pkill as able to kill a process base on name.  
As I understand, the process isn't nonsensical.bash, it's sleep 10.  Can 
others duplicate your result?

I'm curious, does "pgrep nonsensical" find the running script on your 
box?  It doesn't on mine, and shouldn't as I understand for the same 
logic as above.