From 5c4aae968124b820302fbc8b307e80a00a664357 Mon Sep 17 00:00:00 2001 From: lizhifeng Date: Tue, 19 Apr 2022 13:33:25 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/run.sh | 52 +++++++++++++++++++++++++ bin/ruoyi.sh | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++ bin/setenv.sh | 35 +++++++++++++++++ 3 files changed, 190 insertions(+) create mode 100755 bin/run.sh create mode 100755 bin/ruoyi.sh create mode 100644 bin/setenv.sh diff --git a/bin/run.sh b/bin/run.sh new file mode 100755 index 000000000..a582cdbfd --- /dev/null +++ b/bin/run.sh @@ -0,0 +1,52 @@ +#!/bin/sh + +# Licensed 描述 +# +# +# +# +# ----------------------------------------------------------------------------- +# 开始 脚本 服务 +# ----------------------------------------------------------------------------- + +# 解析链接- $0可能是软链接 +PRG="$0" + +while [ -h "$PRG" ]; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`/"$link" + fi +done +#echo $PRG + +# 获取标准环境变量 +PRGDIR=`dirname "$PRG"` + +#echo $PRG + +PRGDIR=`dirname "$PRG"` +EXECUTABLE=ruoyi.sh + +#判断入口参数进行脚本执行 +case "$1" in + + start) + exec "$PRGDIR"/"$EXECUTABLE" start "$@" + echo "Starting Ruoyi ... " + + ;; + stop) + exec "$PRGDIR"/"$EXECUTABLE" stop "$@" + echo "Stoping Ruoyi" + ;; + + *) + echo "{start|stop}" +esac + +exit 0 + diff --git a/bin/ruoyi.sh b/bin/ruoyi.sh new file mode 100755 index 000000000..c9efeb464 --- /dev/null +++ b/bin/ruoyi.sh @@ -0,0 +1,103 @@ +#!/bin/sh + +# Licensed 描述 +# +# +# +# +# ----------------------------------------------------------------------------- +# +# 环境变量 +# +# 请不要在这里设置您的变量脚本,若要设置请移步 +# setenv.sh +# +# RUOYI_HOME 可以指向您的“构建”目录。 +# RUOYI_BASE (可选)解析RUOYI安装的动态部分的基目录#。如果不存在,解析为# RUOYI HOME指向的相同目录。 +# JAVA_OPTS (可选)Java运行时选项,请在 setenv.sh 中设置 +# JAVA_HOME 必须指向您的Java开发工具包安装。#使用"debug"参数运行 +# JRE_HOME 必须指向您的Java运行时环境。 +# 如果为空,默认为JAVA HOME。如果同时设置JRE HOME和JAVA HOME #,则使用JRE HOME。 +# RUOYI_PID (可选)当使用时,包含RUOYI启动java进程 pid 的文件路径 +# RUOYI_CMD 执行命令字符串 +# ----------------------------------------------------------------------------- + +# 解析链接- $0可能是软链接 +PRG="$0" + +while [ -h "$PRG" ]; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`/"$link" + fi +done +#echo $PRG + +# 获取标准环境变量 +PRGDIR=`dirname "$PRG"` + +# 设置构建目录 +[ -z "$RUOYI_HOME" ] && RUOYI_HOME=`cd "$PRGDIR/.." >/dev/null; pwd` + +[ -z "$RUOYI_BASE" ] && RUOYI_BASE="$RUOYI_HOME" + +#确保在启动时不使用任何用户定义的CLASSPATH变量, +#但允许在 setenv.sh 中指定它们,在极少数情况下需要时。 + +CLASSPATH= + +if [ -r "$RUOYI_BASE/bin/setenv.sh" ]; then + . "$RUOYI_BASE/bin/setenv.sh" +elif [ -r "$RUOYI_HOME/bin/setenv.sh" ]; then + . "$RUOYI_HOME/bin/setenv.sh" +fi + + +# java 命令位置 +if [ -z "$JAVA_HOME" ]; then + JAVA_BIN="`which java 2>/dev/null || type java 2>&1`" + while [ -h "$JAVA_BIN" ]; do + ls=`ls -ld "$JAVA_BIN"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + JAVA_BIN="$link" + else + JAVA_BIN="`dirname "$JAVA_BIN"`/$link" + fi + done + test -x "$JAVA_BIN" && JAVA_HOME="`dirname "$JAVA_BIN"`" + test ".$JAVA_HOME" != . && JAVA_HOME=`cd "$JAVA_HOME/.." >/dev/null; pwd` +else + JAVA_BIN="$JAVA_HOME/bin/java" +fi + +# 设置 -pidfile +test ".$RUOYI_PID" = . && RUOYI_PID="$RUOYI_BASE/logs/ruoyi.pid" + +RUOYI_CMD="nohup $JAVA_BIN -jar $RUOYI_BASE/ruoyi-admin/target/ruoyi-admin.jar $JAVA_OPTS >/dev/null 2>&1 &" +echo $RUOYI_PID +#echo $PRG $RUOYI_BASE $JAVA_OPTS $JAVA_BIN $RUOYI_PID $RUOYI_CMD + +touch "$RUOYI_PID" + + +#eval exec "$RUOYI_CMD" + + + +if [ "$1" = "start" ] ; then + eval exec "$RUOYI_CMD" + if [ ! -z "$RUOYI_PID" ]; then + echo $! > "$RUOYI_PID" + fi + +elif [ "$1" = "stop" ] ; then + #echo "stop" + kill -9 `cat "$RUOYI_PID"` >/dev/null 2>&1 + +fi + + \ No newline at end of file diff --git a/bin/setenv.sh b/bin/setenv.sh new file mode 100644 index 000000000..79491ed70 --- /dev/null +++ b/bin/setenv.sh @@ -0,0 +1,35 @@ +#!/bin/sh +# Licensed 描述 + +# +# JAVA_HOME +# JAVA_OPTS +# +# ----------------------------------------------------------------------------- +# 开始 脚本 服务 +# ----------------------------------------------------------------------------- + +# 解析链接- $0可能是软链接 +PRG="$0" + +while [ -h "$PRG" ]; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`/"$link" + fi +done +#echo $PRG + +# 获取标准环境变量 +PRGDIR=`dirname "$PRG"` + +#echo $PRG + +PRGDIR=`dirname "$PRG"` + +JAVA_OPTS="-Xms256m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m" + + From f05464ec79b27fffd0a58aed47e1129aedd02bd7 Mon Sep 17 00:00:00 2001 From: lizhifeng Date: Tue, 19 Apr 2022 14:28:47 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=88=90=E4=B8=BA?= =?UTF-8?q?=E7=9B=B8=E5=AF=B9=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-admin/src/main/resources/logback.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-admin/src/main/resources/logback.xml b/ruoyi-admin/src/main/resources/logback.xml index d69a57207..922c2762a 100644 --- a/ruoyi-admin/src/main/resources/logback.xml +++ b/ruoyi-admin/src/main/resources/logback.xml @@ -1,7 +1,7 @@ - + From 0d85eecb06c30d08a9ce3bb38e9bb044d0a459e3 Mon Sep 17 00:00:00 2001 From: lizhifeng Date: Tue, 19 Apr 2022 22:07:36 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E8=BF=90=E8=A1=8C./run.sh=20start=20=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/run.sh | 6 ++++-- bin/ruoyi.sh | 16 ++++++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/bin/run.sh b/bin/run.sh index a582cdbfd..6683acd1f 100755 --- a/bin/run.sh +++ b/bin/run.sh @@ -35,13 +35,15 @@ EXECUTABLE=ruoyi.sh case "$1" in start) - exec "$PRGDIR"/"$EXECUTABLE" start "$@" echo "Starting Ruoyi ... " + exec "$PRGDIR"/"$EXECUTABLE" start "$@" + ;; stop) + echo "Stoping Ruoyi ... " exec "$PRGDIR"/"$EXECUTABLE" stop "$@" - echo "Stoping Ruoyi" + ;; *) diff --git a/bin/ruoyi.sh b/bin/ruoyi.sh index c9efeb464..4b0c77b1d 100755 --- a/bin/ruoyi.sh +++ b/bin/ruoyi.sh @@ -76,9 +76,10 @@ fi # 设置 -pidfile test ".$RUOYI_PID" = . && RUOYI_PID="$RUOYI_BASE/logs/ruoyi.pid" +LOGBACK="-Dlogback.configurationFile=file:$RUOYI_BASE/ruoyi-admin/src/main/resources/logback.xml" -RUOYI_CMD="nohup $JAVA_BIN -jar $RUOYI_BASE/ruoyi-admin/target/ruoyi-admin.jar $JAVA_OPTS >/dev/null 2>&1 &" -echo $RUOYI_PID +RUOYI_CMD="nohup $JAVA_BIN -jar $RUOYI_BASE/ruoyi-admin/target/ruoyi-admin.jar $LOGBACK $JAVA_OPTS >/dev/null 2>&1 &" +#echo $RUOYI_HOME $RUOYI_BASE $LOGBACK #echo $PRG $RUOYI_BASE $JAVA_OPTS $JAVA_BIN $RUOYI_PID $RUOYI_CMD touch "$RUOYI_PID" @@ -89,9 +90,16 @@ touch "$RUOYI_PID" if [ "$1" = "start" ] ; then - eval exec "$RUOYI_CMD" - if [ ! -z "$RUOYI_PID" ]; then + PID=`cat $RUOYI_PID` + ps -p $PID >/dev/null 2>&1 + if [ $? -eq 0 ] ; then + echo "RuoYi appears to still be running with PID $PID. Start aborted." + echo "If the following process is not a RuoYi process, remove the PID file and try again:" + exit 1 + elif [ ! -z "$RUOYI_PID" ]; then + eval exec "$RUOYI_CMD" echo $! > "$RUOYI_PID" + #exit 1 fi elif [ "$1" = "stop" ] ; then From fefd8abcc52792d204b7d21d6db9712643f16eb2 Mon Sep 17 00:00:00 2001 From: lizhifeng <4593645@qq.com> Date: Thu, 21 Apr 2022 19:04:37 +0800 Subject: [PATCH 4/4] =?UTF-8?q?mvn=20=C2=A0=E8=87=AA=E5=8A=A8=E5=8C=96?= =?UTF-8?q?=E6=8E=A8=E5=85=A5sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 1 + .../src/main/resources/application-druid.yml | 4 +- ruoyi-admin/src/main/resources/logback.xml | 4 +- ruoyi-sql/pom.xml | 90 +++++++++++++++++++ {sql => ruoyi-sql}/quartz.sql | 0 {sql => ruoyi-sql}/ry_20210908.sql | 0 6 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 ruoyi-sql/pom.xml rename {sql => ruoyi-sql}/quartz.sql (100%) rename {sql => ruoyi-sql}/ry_20210908.sql (100%) diff --git a/pom.xml b/pom.xml index b693251fc..5ca1b779b 100644 --- a/pom.xml +++ b/pom.xml @@ -209,6 +209,7 @@ ruoyi-quartz ruoyi-generator ruoyi-common + ruoyi-sql pom diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index 1f098e407..4ce9c066f 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -6,9 +6,9 @@ spring: druid: # 主库数据源 master: - url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:mysql://localhost:3306/ry_vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root - password: password + password: root # 从库数据源 slave: # 从数据源开关/默认关闭 diff --git a/ruoyi-admin/src/main/resources/logback.xml b/ruoyi-admin/src/main/resources/logback.xml index 922c2762a..b900d1051 100644 --- a/ruoyi-admin/src/main/resources/logback.xml +++ b/ruoyi-admin/src/main/resources/logback.xml @@ -1,7 +1,9 @@ - + + + diff --git a/ruoyi-sql/pom.xml b/ruoyi-sql/pom.xml new file mode 100644 index 000000000..1cc9d1c8c --- /dev/null +++ b/ruoyi-sql/pom.xml @@ -0,0 +1,90 @@ + + + + ruoyi + com.ruoyi + 3.8.2 + + 4.0.0 + ruoyi-sql + jar + + + + + + org.codehaus.mojo + sql-maven-plugin + 1.5 + + + + mysql + mysql-connector-java + 5.1.27 + + + + + com.mysql.jdbc.Driver + jdbc:mysql://localhost:3306/ry_vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + root + root + true + + + + create-data + generate-sources + + execute + + + true + + quartz.sql + ry_20210908.sql + + + + + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + + org.codehaus.mojo + + + sql-maven-plugin + + + [1.5,) + + + execute + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sql/quartz.sql b/ruoyi-sql/quartz.sql similarity index 100% rename from sql/quartz.sql rename to ruoyi-sql/quartz.sql diff --git a/sql/ry_20210908.sql b/ruoyi-sql/ry_20210908.sql similarity index 100% rename from sql/ry_20210908.sql rename to ruoyi-sql/ry_20210908.sql