Fork me on GitHub

程序启动停止的shell脚本

程序启动停止的shell脚本

启动脚本start.sh

执行python api.py命令脚本如下

app=api 
basePy=/opt/conda/envs/chatglm2
pid=`ps -ef | grep "$app.py" | grep -v grep | awk '{print $2}'`
if [ ! -z $pid ];then    
    echo "$app is running, pid $pid"
    exit 1
fi
nohup $basePy/bin/python   $app.py >> log/info.log 2>&1 &

停止脚本stop.sh

kill -9 `ps -ef|grep api.py|grep -v grep|awk '{print $2}'`
posted @ 2023-09-01 10:04  壶小旭  阅读(49)  评论(0编辑  收藏  举报