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


  • 相关阅读:
    仿pinterest实现瀑布流布局效果
    .NET执行cmd时,如何调试命令的执行效果
    在Sharepoint 2007 整合Discuz Nt论坛
    如何使用EWS获取邮件及其附件
    启明星win7桌面天气预报软件下载与使用方法(带时间)
    【helpdesk】启明星helpdesk7.0版本里,实现邮件提交功能介绍和原理
    微软.NET设计上的一个错误(从.NET1.14.0),不知道以后.NET会不会修复这个错误
    什么是Traceback Ping
    用ASP生成RSS以及讀取RSS
    [轉]訂單編號方式探討
  • 原文地址:https://www.cnblogs.com/curedfisher/p/13039872.html
Copyright © 2011-2022 走看看