Linux 運行Spring-boot Jar包程序 Shell 腳本

start-app-nohub.sh

#/bin/bash
pid=`netstat -anp|grep 8080|awk '{printf $7}'|cut -d/ -f1`
if [ ! $pid ] ;then
  echo "端口未被佔用"
else
  echo "佔用端口8080進程PID爲: $pid"
  result=`kill -9 $pid`
  #echo "result = $result"
  rm -f test_console.log
fi

nohup java -jar test-console.jar >> test_console.log 2>&1 &
相關文章
相關標籤/搜索