#!/bin/sh
#进入主目录
cd /home/script/analysis_log
# 判断进程是否存在,再启动
python_pid_cound=`ps -ef | grep portal_analysis_log.py | grep -v grep | awk '{print $2}' | wc -l`
python_pid=`ps -ef | grep portal_analysis_log.py | grep -v grep | awk '{print $2}'`
if [ $python_pid_cound -eq 0 ];then
echo '进程没启动,需要启动一下'
/usr/bin/nohup python3 portal_analysis_log.py > logs/analysis.log 2>&1 &
else
echo '进程已启动,杀死再启动一下'
kill -9 $python_pid
/usr/bin/nohup python3 portal_analysis_log.py > logs/analysis.log 2>&1 &
fi
echo 'portal_analysis_log.py 启动完成'
python脚本的shell的启动脚本
最新推荐文章于 2024-06-18 10:07:55 发布