linux 启动java jar文件脚本
#!/bin/bash
export NACOS_ADDR=192.168.1.5:8848
export NACOS_NAMESPACE=test
export NACOS_DUBBO_NAMESPACE=dubbi
export JAVA_OPTS="-Xms128m -Xmx256m -Djava.security.egd=file:/dev/./urandom"
case $1 in
"start"){
echo -------------------------------- gateway 启动 ---------------------------
nohup java $JAVA_OPTS -jar gateway.jar &> out/gateway.out &
echo -------------------------------- auth 启动 ---------------------------
nohup java $JAVA_OPTS -jar auth.jar &> out/auth.out &
echo -------------------------------- wms 启动 ---------------------------
nohup java $JAVA_OPTS -jar wms-admin.jar &> out/wms.out &
echo -------------------------------- oms 启动 ---------------------------
nohup java $JAVA_OPTS -jar oms-admin.jar &> out/oms.out &
echo -------------------------------- mes 启动 ---------------------------
nohup java $JAVA_OPTS -jar mes-admin.jar &> out/mes.out &
echo -------------------------------- sender 启动 ---------------------------
nohup java $JAVA_OPTS -jar comm-sender.jar &> out/sender.out &
echo -------------------------------- reciever 启动 ---------------------------
nohup java $JAVA_OPTS -jar comm-reciever.jar &> out/reciever.out &
echo -------------------------------- processer 启动 ---------------------------
nohup java $JAVA_OPTS -jar comm-processer.jar &> out/processer.out &
echo -------------------------------- provide 启动 ---------------------------
nohup java -DDUBBO_IP_TO_BIND="192.168.1.50" $JAVA_OPTS -jar comm-provide.jar &> out/provide.out &
echo -------------------------------- upms 启动 ---------------------------
nohup java -DDUBBO_IP_TO_BIND="192.168.1.50" $JAVA_OPTS -jar upms-admin.jar &> out/admin.out &
echo -------------------------------- device 启动 ---------------------------
nohup java -DDUBBO_IP_TO_BIND="192.168.1.50" $JAVA_OPTS -jar device-platform.jar &> out/device.out &
}
;;
"gateway"){
echo -------------------------------- gateway 启动 ---------------------------
nohup java $JAVA_OPTS --server.port=9001 --spring.profiles.active=prod -jar gateway.jar &> out/gateway.out &
}
;;
"wms"){
echo -------------------------------- wms 启动 ---------------------------
nohup java $JAVA_OPTS -jar wms-admin.jar &> out/wms.out &
}
;;
"mes"){
echo -------------------------------- mes启动 ---------------------------
nohup java $JAVA_OPTS -jar mes-admin.jar &> out/mes.out &
}
;;
"admin"){
echo -------------------------------- admin启动 ---------------------------
nohup java -DDUBBO_IP_TO_BIND="192.168.1.50" $JAVA_OPTS -jar upms-admin.jar &> out/admin.out &
}
;;
"device"){
echo -------------------------------- device 启动 ---------------------------
nohup java -DDUBBO_IP_TO_BIND="192.168.1.50" $JAVA_OPTS -jar device-platform.jar &> out/device.out &
}
;;
"sender"){
echo -------------------------------- sender启动 ---------------------------
nohup java -jar comm-sender.jar &> out/sender.out &
}
;;
"reciever"){
echo -------------------------------- reciever启动 ---------------------------
nohup java $JAVA_OPTS -jar comm-reciever.jar &> out/reciever.out &
}
;;
"processer"){
echo -------------------------------- processer启动 ---------------------------
nohup java $JAVA_OPTS -jar comm-processer.jar &> out/processer.out &
}
;;
"provide"){
echo -------------------------------- provide启动 ---------------------------
nohup java -DDUBBO_IP_TO_BIND="192.168.1.50" $JAVA_OPTS -jar comm-provide.jar &> out/provide.out &
}
;;
"oms"){
echo -------------------------------- oms 启动 ---------------------------
nohup java $JAVA_OPTS -jar oms-admin.jar &> out/oms.out &
}
;;
"mes"){
echo -------------------------------- mes启动 ---------------------------
nohup java $JAVA_OPTS -jar mes-admin.jar &> out/mes.out &
}
;;
"auth"){
echo -------------------------------- auth启动 ---------------------------
nohup java $JAVA_OPTS -jar auth.jar &> out/auth.out &
}
;;
"device"){
echo -------------------------------- device 启动 ---------------------------
nohup java -DDUBBO_IP_TO_BIND="192.168.1.50" $JAVA_OPTS -jar device-platform.jar &> out/device.out &
}
;;
"sender"){
echo -------------------------------- sender启动 ---------------------------
nohup java $JAVA_OPTS -jar comm-sender.jar &> out/sender.out &
}
;;
"stop"){
echo -------------------------------- all kill---------------------------
ps -ef|grep zngx|grep java|awk '{print $2}'|xargs kill -9
}
;;
"ps"){
ps -ef|grep zngx
}
;;
esac