#!/bin/bash # kill java进程 java_sso_prod_pid=`ps aux|grep sso.jar|grep -v "grep"|awk '{print $2}'` if [ "$java_sso_prod_pid" ];then ps aux|grep sso.jar|grep -v "grep"|awk '{print $2}'|xargs kill -9 echo -e " 33[32m[ old javar sso prod process is killed ] 33[0m" fi #重启java进程 source /etc/profile nohup java -jar sso.jar -Xms512m -Xmx2048m --spring.profiles.active=prod --server.port=8080 >>/home/deploy/sso-boot-prod/sso_jar.log & sleep 5 java_process=` ps aux|grep sso.jar|grep -v "grep"|awk '{print $2}' ` echo $java_process if [ "$java_process" ];then echo -e " 33[32m[ java sso process started success on prod env ! ] 33[0m" fi