restart.sh脚本模板

发布时间 2023-06-15 10:01:08作者: 钱塘江畔
#!/bin/bash

cd /data/openapi

tmp2=`ps -ef |grep old |awk '{print $2}'|xargs kill -9`
sleep 10;
apimps=`ps gaux | grep old  |grep -v grep |awk '{print $2}'`

if [ "$apim" == "" ] || [ $apim -ge 0 ];then
        tmp2=`ps -ef | grep old  |awk '{print $2}'|xargs kill -9`
        sleep 10;
        echo "---> Start the openapi."
        nohup java -jar old -0.0.2-SNAPSHOT.jar > nohup.out 2>&1 &
else
        echo "---> Start the openapi ."
        nohup java -jar old -0.0.2-SNAPSHOT.jar > nohup.out 2>&1 &
fi