Scheduler quartzScheduler_$_NON_CLUSTERED shutdown complete.服务器jar自动停了

avatar
作者
筋斗云
阅读量:0

报错如下

22:18:55.855 [SpringApplicationShutdownHook] INFO  o.q.c.QuartzScheduler - [standby,585] - Scheduler quartzScheduler_$_NON_CLUSTERED paused.
22:18:55.905 [SpringApplicationShutdownHook] INFO  o.q.c.QuartzScheduler - [shutdown,666] - Scheduler quartzScheduler_$_NON_CLUSTERED shutting down.
22:18:55.906 [SpringApplicationShutdownHook] INFO  o.q.c.QuartzScheduler - [standby,585] - Scheduler quartzScheduler_$_NON_CLUSTERED paused.
22:18:55.906 [SpringApplicationShutdownHook] INFO  o.q.c.QuartzScheduler - [shutdown,740] - Scheduler quartzScheduler_$_NON_CLUSTERED shutdown complete.

22:18:55.907 [SpringApplicationShutdownHook] INFO  sys-user - [shutdownAsyncManager,31] - ====关闭后台任务任务线程池====
22:18:55.916 [SpringApplicationShutdownHook] INFO  c.a.d.p.DruidDataSource - [close,2174] - {dataSource-1} closing ...
22:18:55.919 [SpringApplicationShutdownHook] INFO  c.a.d.p.DruidDataSource - [close,2247] - {dataSource-1} closed

原因,java -jar 方式启动jar包,窗口或者网络一断,jar就停止了

所以要以另一种方式来运行,具体可以去看下nohup ,新建一个.sh的文件内容如下,环境变量jar包路径等换成你的

#!/bin/bash

# 设置环境变量
export JAVA_HOME=/usr/local/java/jdk-17.0.10
export CLASSPATH=.:$JAVA_HOME/lib/
export PATH=.:$JAVA_HOME/bin:$PATH

# Java应用的JAR文件路径
JAR_PATH="/usr/local/rouyi/ruoyi-admin.jar"

# 定义日志文件输出路径
LOG_FILE="/usr/local/rouyi/rouyimonitor.log"

# 使用nohup命令启动Java应用,并将输出重定向到日志文件
nohup java --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/sun.net.util=ALL-UNNAMED -jar -Xms1024M -Xmx2048M -XX:MetaspaceSize=1024M -XX:MaxMetaspaceSize=2048M $JAR_PATH > $LOG_FILE 2>&1 &

# 回显启动信息
echo "Java application started. Check the log at $LOG_FILE"
 

执行命令

赋权

chmod +x rouyimonitor.sh

运行脚本

./rouyimonitor.sh

查看启动日志

tail -f rouyimonitor.log

停止

kill -9 $(pgrep -f ruoyi-admin.jar)

广告一刻

为您即时展示最新活动产品广告消息,让您随时掌握产品活动新动态!