I have many processes with similar names, like "proc_1asd, proc_2wqe, proc_3zxc"
I need to send a non-brutal interruption signal to them all, pkill -f
would work, but it's not installed.
I'm trying to use killall -r proc_*
, but I get this error
proc_*: no process found
I have the impression I'm doing something extremely stupid, but I don't know what.
Here's an image (actual name of the processes is jnode_something)
pgrep -lf 'proc_.*'
returns
15070 jnode_0 -cp lib/xstream-1.4.7.jar:build/classes sandbox.GridNode Configs/0_config.txt Logs
15071 jnode_1 -cp lib/xstream-1.4.7.jar:build/classes sandbox.GridNode Configs/1_config.txt Logs
15072 jnode_2 -cp lib/xstream-1.4.7.jar:build/classes sandbox.GridNode Configs/2_config.txt Logs
15073 jnode_3 -cp lib/xstream-1.4.7.jar:build/classes sandbox.GridNode Configs/3_config.txt Logs
15074 jnode_4 -cp lib/xstream-1.4.7.jar:build/classes sandbox.GridNode Configs/4_config.txt Logs
Seems like overkill, but if you can get the PIDs from pgrep, just use them as arguments to kill. Something like:
pgrep -lf 'proc_.*' | awk '{print $1}' | xargs kill -f
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With