💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、豆包、星火、月之暗面及文生图、文生视频 广告
#!/bin/bash #source /etc/profile #export JAVA_HOME=/opt/jdk #export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin #export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar JarName="reg" SpringBoots=`ls ../jars/gmv-register.jar` if [ "$SpringBoots" = "" ]; then echo -e "\033[0;31m 文件中没有对应的应用 \033[0m" exit 1 fi for sb in $SpringBoots do SpringBoot=$sb break done function start() { count=`ps -ef |grep java|grep $SpringBoot|grep -v grep|wc -l` if [ $count != 0 ];then echo ">>>$SpringBoot Already Running , Exit...<<<" else nohup java -Xmx512m -Xms128m -Xmn256m -server -jar $SpringBoot > ../tmp-log/$JarName.log 2>&1 & echo -e "\n" echo ">>>Start $SpringBoot success...<<<" echo -e "\n" tail -f ../tmp-log/$JarName.log fi } function stop() { uuu echo "Stop $SpringBoot" boot_id=`ps -ef |grep java|grep $SpringBoot|grep -v grep|awk '{print $2}'` count=`ps -ef |grep java|grep $SpringBoot|grep -v grep|wc -l` if [ $count != 0 ];then kill $boot_id count=`ps -ef |grep java|grep $SpringBoot|grep -v grep|wc -l` boot_id=`ps -ef |grep java|grep $SpringBoot|grep -v grep|awk '{print $2}'` kill -9 $boot_id fi uuu } function uuu(){ echo -e "\n" ps aux | grep gmv echo -e "\n" } function restart() { stop sleep 2 start } function status() { pid=`ps -ef|grep $SpringBoots|grep -v grep|awk '{print $2}' ` count=`ps -ef |grep java|grep $SpringBoot|grep -v grep|wc -l` if [ $count != 0 ];then echo -e "\033[32m >>>$SpringBoot is running...PID=${pid}<<< \033[0m" else echo -e "\033[31m >>>$SpringBoot is not running...<<< \033[0m" fi } if [ "$1" = "" ]; then echo -e "\n" echo -e "\033[0;34m more usage:[start|stop|restart|status] \033[0m" echo -e "\n" ps aux | grep gmv echo -e "\n" echo -e "start $SpringBoot >>> " start exit 1 fi case $1 in start) start;; stop) stop;; restart) restart;; status) status;; *) echo -e "\033[0;31m Usage: \033[0m \033[0;34m sh $0 {start|stop|restart|status} \033[0m \033[0;31m Example: \033[0m \033[0;33m sh $0 start test.jar \033[0m" esac