宝塔面板计划任务-重启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

posted @ 2024-04-25 09:31  动灵  阅读(3)  评论(0编辑  收藏  举报