shell 脚本启动spring boot的jar 包
#!/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 "\033[32m[ old javar sso prod process is killed ]\033[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 "\033[32m[ java sso process started success on prod env ! ]\033[0m" fi