import os, re, signal, subprocess, time
PAT = re.compile(r"shoot_09[2]5")
me = os.getpid()
killed = []
out = subprocess.run(["ps", "-eo", "pid=,args="], capture_output=True, text=True).stdout
for line in out.splitlines():
    sp = line.strip().split(None, 1)
    if len(sp) < 2:
        continue
    pid, args = int(sp[0]), sp[1]
    if pid == me or "kills2" in args:
        continue
    if PAT.search(args):
        try:
            os.kill(pid, signal.SIGKILL)
            killed.append(pid)
        except Exception:
            pass
time.sleep(2)
print("killed:", killed)
