Linux批量清理Webman进程

创建脚本clean_webman.sh

#!/bin/bash

echo "=== 清理旧Webman进程 ==="

# 1. 查找所有webman相关进程
echo "1. 当前运行的webman进程:"
ps aux | grep -E "(webman|workerman|start\.php)" | grep -v grep

# 2. 停止8787端口的进程
echo -e "\n2. 停止8787端口进程:"
for pid in $(lsof -ti:8787); do
    echo "  杀死进程 $pid"
    kill -9 $pid 2>/dev/null
done

# 3. 停止旧的start.php进程
echo -e "\n3. 停止旧的start.php进程:"
for pid in $(ps aux | grep "start\.php" | grep -v grep | awk '{print $2}'); do
    echo "  杀死进程 $pid"
    kill -9 $pid 2>/dev/null
done

# 4. 验证清理结果
echo -e "\n4. 清理后8787端口状态:"
netstat -tlnp | grep 8787 || echo "   8787端口已空闲"

echo -e "\n5. 清理后webman进程状态:"
ps aux | grep -E "(webman|workerman|start\.php)" | grep -v grep || echo "   无webman进程运行"

echo -e "\n=== 清理完成 ==="

 

执行脚本

chmod +x clean_webman.sh
./clean_webman.sh

 

posted @ 2025-12-14 02:50  悬剑丶  阅读(2)  评论(0)    收藏  举报