#!/bin/bash

# 获取所有screen会话并关闭它们
screen -ls | grep Detached | cut -d. -f1 | awk '{print $1}' | while read pid
do
    echo "正在终止screen会话: $pid"
    screen -S $pid -X quit
done

echo "所有screen会话已终止"

# 为了以防万一，也可以直接杀死相关进程
for prog in compare media face fall cpm_analyze cpm_scene pose yolo
do
    echo "正在检查并终止 $prog 相关进程"
    pkill -f $prog
done

echo "清理完成"