문제

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)

Task manager screenshot

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top