This commit is contained in:
parent
06470796c2
commit
7422bec2e3
70
springboot.sh
Normal file
70
springboot.sh
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# 定义变量
|
||||||
|
APP_NAME="ims"
|
||||||
|
APP_JAR="/ims/app/ims.jar" # 替换为你的 JAR 包路径
|
||||||
|
CONFIG_FILE="/ims/app/application.yml" # 替换为你的配置文件路径
|
||||||
|
LOG_FILE="/ims/app/ims.log" # 日志文件路径
|
||||||
|
PID_FILE="/ims/app/ims.pid" # 保存进程 ID 的文件
|
||||||
|
|
||||||
|
# 启动函数
|
||||||
|
start() {
|
||||||
|
if [ -f "$PID_FILE" ]; then
|
||||||
|
PID=$(cat "$PID_FILE")
|
||||||
|
if ps -p "$PID" > /dev/null; then
|
||||||
|
echo "Application $APP_NAME is already running with PID $PID."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
rm -f "$PID_FILE"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Starting $APP_NAME..."
|
||||||
|
nohup java -jar "$APP_JAR" --spring.config.location="$CONFIG_FILE" > "$LOG_FILE" 2>&1 &
|
||||||
|
echo $! > "$PID_FILE"
|
||||||
|
echo "Application $APP_NAME started with PID $!."
|
||||||
|
}
|
||||||
|
|
||||||
|
# 停止函数
|
||||||
|
stop() {
|
||||||
|
if [ -f "$PID_FILE" ]; then
|
||||||
|
PID=$(cat "$PID_FILE")
|
||||||
|
if ps -p "$PID" > /dev/null; then
|
||||||
|
echo "Stopping $APP_NAME with PID $PID..."
|
||||||
|
kill "$PID"
|
||||||
|
rm -f "$PID_FILE"
|
||||||
|
echo "Application $APP_NAME stopped."
|
||||||
|
else
|
||||||
|
echo "Application $APP_NAME is not running."
|
||||||
|
rm -f "$PID_FILE"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "PID file not found. Application $APP_NAME may not be running."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# 重启函数
|
||||||
|
restart() {
|
||||||
|
stop
|
||||||
|
sleep 2
|
||||||
|
start
|
||||||
|
}
|
||||||
|
|
||||||
|
# 脚本入口
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
start
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
stop
|
||||||
|
;;
|
||||||
|
restart)
|
||||||
|
restart
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: $0 {start|stop|restart}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
@ -140,7 +140,8 @@ public class MaterialController {
|
|||||||
private String getCode() {
|
private String getCode() {
|
||||||
String code;
|
String code;
|
||||||
while (true) {
|
while (true) {
|
||||||
code = String.valueOf(R.random(1000, 9999));
|
code = String.valueOf(R.random(10000, 99999));
|
||||||
|
// 需要和前端scan-form.vue中的autoInsertOneRow方法的切割联动修改
|
||||||
try {
|
try {
|
||||||
// 如果代码已经存在,继续循环
|
// 如果代码已经存在,继续循环
|
||||||
if (Strings.isBlank(cache.get(code))) {
|
if (Strings.isBlank(cache.get(code))) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user