宝塔面板计划任务-重启py进程
#!/bin/bash
# 检测进程是否在运行
process=$(ps aux | grep "pytest.py" | grep -v grep)
# 如果进程在运行,则终止它
if [ -n "$process" ]; then
kill $(pgrep -f "pytest.py")
fi
#!/bin/bash
# 检测进程是否在运行
process=$(ps aux | grep "pytest.py" | grep -v grep)
# 如果进程在运行,则终止它
if [ -n "$process" ]; then
kill $(pgrep -f "pytest.py")
fi
# 重新启动进程
nohup python /home/www/wwwroot/pytest.py