zoukankan      html  css  js  c++  java
  • shell启动java项目的脚本

    #!/bin/sh
    JAR_NAME=material.jar
    
    tpid=`ps -ef|grep $JAR_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
    if [ ${tpid} ]; then
    	echo 'Stop Process...'
    fi
    sleep 5
    tpid=`ps -ef|grep $JAR_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
    if [ ${tpid} ]; then
    	echo 'Kill Process!'
    	kill -9 $tpid
    else
    	echo 'Stop Success!'
    fi
    
    tpid=`ps -ef|grep $JAR_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
    if [ ${tpid} ]; then
    	        echo 'App is running.'
    	else
    		        echo 'App is NOT running.'
    		fi
    
    		rm -f tpid
    #		nohup java -jar ./$JAR_NAME --spring.profiles.active=test >/dev/null 2>&1 &
    		nohup java -jar /home/javaweb/matrial/$JAR_NAME  >/home/javaweb/matrial/mat.log 2>&1 &
    		echo $! > tpid
    		echo 'Start Success!'
    

      

  • 相关阅读:
    经典语录二
    squid通过正向代理访问互联网
    jQuery
    CSS常用属性
    css基本选择器
    html标签
    事件驱动模型与IO模型
    协程
    进程与线程
    软件安装 yum rpm
  • 原文地址:https://www.cnblogs.com/HHR-SUN/p/14554273.html
Copyright © 2011-2022 走看看