1. 程式人生 > >Shell指令碼學習&SpringBoot啟動關閉指令碼

Shell指令碼學習&SpringBoot啟動關閉指令碼

一、Shell指令碼學習手冊

傳送門

二、SpringBoot Shell啟動關閉指令碼

springboot 啟動指令碼

#!/bin/sh
ps -ef |grep sell-0.0.1-SNAPSHOT.jar |grep -v grep
if [ $? -eq 0 ];then
  echo 'Server is running!!'
else
  echo 'Server starging...'
  nohup java -jar sell-0.0.1-SNAPSHOT.jar >/dev/null 2>&1 &
fi

springboot 停止指令碼

#!/bin/sh
ps -ef | grep hrserver-1.0.0.jar| grep -v grep
if [ $? -eq 0 ];then
  PID_9050=$(ech
  o `netstat -apn |grep 9050 | awk '{print $NF}'|awk -F '/' '{print $1}'`)
  kill $PID_9050
  echo 'HRServer has shutdown!'
else
  echo 'Not Found HRServer!!!'
fi

標記:聽聞愛情,十人九悲,何不兩清,做回甲乙丙。聽聞回憶,十憶九傷,何不忘掉曾經,珍惜現在。聽聞青春,十言九妄 ,何不放下,隨風東南西北。聽聞清楚,十有九錯 ,何不疏狂,喜時飲酒逐月。聽聞紅坐,十有九故,何不淡泊。