From f2e10a506200072228f82fbaf1f7cc31adf45b98 Mon Sep 17 00:00:00 2001 From: fuhouyin Date: Tue, 24 Dec 2024 15:27:16 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E8=A1=A5=E9=BD=90=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.yml | 38 ++++++++--------- src/main/resources/logback.xml | 38 +++++++++++++++++ src/main/resources/server | 66 ++++++++++++++++++++++++++++++ 3 files changed, 123 insertions(+), 19 deletions(-) create mode 100644 src/main/resources/logback.xml create mode 100644 src/main/resources/server diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index d9e3e8c..c9b6e9a 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -6,24 +6,24 @@ spring: name: darkness datasource: driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://39.99.244.11:3306/konosuba?useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai - username: konosuba - password: kKWjPDYDMLtLaLwY + url: jdbc:mysql://localhost:3306/darkness?useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai + username: root + password: root type: com.zaxxer.hikari.HikariDataSource - elasticsearch: - uris: localhost:9200 - cluster-name: elasticsearch - properties: - http: - enabled: true - path: /_search - connect-timeout: 10000 - socket-timeout: 30000 - transport: - tcp: - connect-timeout: 10000 - socket-timeout: 30000 - discovery: - zen: - ping.unicast.hosts: localhost:9300 +# elasticsearch: +# uris: localhost:9200 +# cluster-name: elasticsearch +# properties: +# http: +# enabled: true +# path: /_search +# connect-timeout: 10000 +# socket-timeout: 30000 +# transport: +# tcp: +# connect-timeout: 10000 +# socket-timeout: 30000 +# discovery: +# zen: +# ping.unicast.hosts: localhost:9300 diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml new file mode 100644 index 0000000..dbf7e3f --- /dev/null +++ b/src/main/resources/logback.xml @@ -0,0 +1,38 @@ + + + + + + + logs/server.log + + logs/server.%d{yyyy-MM-dd}.%i.log + 10MB + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level [%logger{36}] [%X{seq}] [%X{uid}] [%X{uri}] - %msg%n + + + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %highlight(%-5level) %cyan([%logger{36}]) [%X{seq}] [%X{uid}] [%X{uri}] - %msg%n + + + + + + + + + + + + + + + diff --git a/src/main/resources/server b/src/main/resources/server new file mode 100644 index 0000000..bb2192e --- /dev/null +++ b/src/main/resources/server @@ -0,0 +1,66 @@ +#!/bin/bash + +source /etc/profile +EVH_HOME=/data/server/darkness +EVH_IOS_HOME=/data/server/importAccountdarkness +LANG=en_US.UTF-8 +export EVH_HOME EVH_IOS_HOME LANG +WAR=darkness-0.0.1-SNAPSHOT.jar +pid=`pgrep -f server/importAccount/importAccount-` +JVM_OPTIONS=`[ -f ${EVH_HOME}/jvm.options ] && cat ${EVH_HOME}/jvm.options |grep -v "^#"` +JAVA_HOME=/usr/local/jdk1.8.0_171/bin + +if [ ! -e $EVH_HOME/$WAR ]; then + echo "importAccount server is not properly installed" +else + if [ "$pid" = "" ]; then + case $1 in + start|restart) + echo "Start importAccount server ..." + rm -rf $EVH_HOME/atomikos + nohup $JAVA_HOME/java ${JVM_OPTIONS} -jar $EVH_HOME/$WAR --spring.config.name=application --logging.config=logback.xml > /dev/null 2>start_err.log & + ;; + stop) + echo importAccount server is not running + ;; + *) + echo "Usage: $0 {start|stop|status|restart}" + esac + else + case $1 in + start) + echo importAccount server is already running + ;; + stop) + echo "importAccount server is stopping ..." + kill $pid + ;; + restart) + kill $pid + for ((i=1;i<=10;i++)) + do + sleep 1 + if [ `ps $pid |wc -l` -gt 1 ];then + echo "importAccount server is stopping ..." + else + break + fi + done + if [ `ps $pid |wc -l` -gt 1 ];then + echo "Stop importAccount server failed,we will stop force" + kill -9 $pid + sleep 5 + echo "Start importAccount server ..." + else + echo "Stop importAccount server succcess" + sleep 1 + echo "Start importAccount server ..." + fi + rm -rf $EVH_HOME/atomikos + nohup java ${JVM_OPTIONS} -jar $EVH_HOME/$WAR --spring.config.name=application --logging.config=logback.xml > /dev/null 2>start_err.log & + ;; + *) + echo "Usage: $0 {start|stop|status|restart}" + esac + fi +fi