zoukankan      html  css  js  c++  java
  • linux_java_同时启动三个项目脚本

    test.sh

    --------------------------------------------------------------------------------------------------------------------------------------

    #!/bin/sh
    while :
    do
    run1=$(ps -ef |grep 'sxnx-sms-8081' |grep -v "grep")
    run2=$(ps -ef |grep 'sxnx-sms-8082' |grep -v "grep")
    run3=$(ps -ef |grep 'sxnx-sms-8083' |grep -v "grep")
    if [ "$run1" ] ; then
    echo "The sxnx-sms-8081 service is alive!"
    else
    echo "The sxnx-sms service was shutdown!"
    echo "Starting service sxnx-sms-8081..."
    nohup java -jar $PWD/sxnx-sms-8081.jar&
    echo "The service sxnx-sms-8081 was started!"
    fi
    if [ "$run2" ] ; then
    echo "The sxnx-sms-8082 service is alive!"
    else
    echo "The sxnx-sms service was shutdown!"
    echo "Starting service sxnx-sms-8082..."
    nohup java -jar $PWD/sxnx-sms-8082.jar&
    echo "The service sxnx-sms-8082 was started!"
    fi
    if [ "$run3" ] ; then
    echo "The sxnx-sms-8083 service is alive!"
    else
    echo "The sxnx-sms service was shutdown!"
    echo "Starting service sxnx-sms-8083..."
    nohup java -jar $PWD/sxnx-sms-8083.jar&
    echo "The service sxnx-sms-8083 was started!"
    fi
    sleep 10
    done

    =======================================================================================================================

    去掉while循环,只执行一次

    #!/bin/sh
    run1=$(ps -ef |grep 'sxnx-sms-8081' |grep -v "grep")
    run2=$(ps -ef |grep 'sxnx-sms-8082' |grep -v "grep")
    run3=$(ps -ef |grep 'sxnx-sms-8083' |grep -v "grep")
    if [ "$run1" ] ; then
    echo "The sxnx-sms-8081 service is alive!"
    else
    echo "The sxnx-sms service was shutdown!"
    echo "Starting service sxnx-sms-8081..."
    nohup java -jar $PWD/sxnx-sms-8081.jar&
    echo "The service sxnx-sms-8081 was started!"
    fi
    if [ "$run2" ] ; then
    echo "The sxnx-sms-8082 service is alive!"
    else
    echo "The sxnx-sms service was shutdown!"
    echo "Starting service sxnx-sms-8082..."
    nohup java -jar $PWD/sxnx-sms-8082.jar&
    echo "The service sxnx-sms-8082 was started!"
    fi
    if [ "$run3" ] ; then
    echo "The sxnx-sms-8083 service is alive!"
    else
    echo "The sxnx-sms service was shutdown!"
    echo "Starting service sxnx-sms-8083..."
    nohup java -jar $PWD/sxnx-sms-8083.jar&
    echo "The service sxnx-sms-8083 was started!"
    fi


  • 相关阅读:
    ruby安装方法
    移动端适配问题px->rem方法
    判断元素阶段类型
    domReady
    电梯导航
    判断浏览器的版本以及浏览器内核( 转发 )
    AWS
    Amazon S3
    Pipeline 模型
    RESTful API
  • 原文地址:https://www.cnblogs.com/curedfisher/p/13039872.html
Copyright © 2011-2022 走看看