-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
152 changed files
with
8,841 additions
and
2,800 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# 拉取最新的源码 | ||
# git pull | ||
|
||
# 停止已运行的服务 | ||
# sh run.sh stop | ||
|
||
# 执行打包 | ||
mvn clean package -Dmaven.test.skip=true | ||
|
||
# 运行 | ||
# sh run.sh start | ||
|
||
echo "mblog打包完毕, 可使用sh run.sh start进行启动" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/bin/bash | ||
APP_NAME=mblog-latest.jar | ||
|
||
usage() { | ||
echo "case: sh run.sh [start|stop|restart|status]" | ||
exit 1 | ||
} | ||
|
||
is_exist(){ | ||
pid=`ps -ef|grep $APP_NAME|grep -v grep|awk '{print $2}' ` | ||
if [ -z "${pid}" ]; then | ||
return 1 | ||
else | ||
return 0 | ||
fi | ||
} | ||
|
||
start(){ | ||
is_exist | ||
if [ $? -eq "0" ]; then | ||
echo "${APP_NAME} running. pid=${pid}" | ||
else | ||
nohup java -jar ./target/$APP_NAME > log.file 2>log.error & | ||
echo "${APP_NAME} started" | ||
fi | ||
} | ||
|
||
stop(){ | ||
is_exist | ||
if [ $? -eq "0" ]; then | ||
kill -9 $pid | ||
echo "${pid} stopped" | ||
else | ||
echo "${APP_NAME} not running" | ||
fi | ||
} | ||
|
||
status(){ | ||
is_exist | ||
if [ $? -eq "0" ]; then | ||
echo "${APP_NAME} running. Pid is ${pid}" | ||
else | ||
echo "${APP_NAME} not running" | ||
fi | ||
} | ||
|
||
restart(){ | ||
stop | ||
start | ||
} | ||
|
||
case "$1" in | ||
"start") | ||
start | ||
;; | ||
"stop") | ||
stop | ||
;; | ||
"status") | ||
status | ||
;; | ||
"restart") | ||
restart | ||
;; | ||
*) | ||
usage | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,28 @@ | ||
package com.mtons.mblog; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration; | ||
import org.springframework.boot.builder.SpringApplicationBuilder; | ||
import org.springframework.boot.web.support.SpringBootServletInitializer; | ||
import org.springframework.cache.annotation.EnableCaching; | ||
import org.springframework.context.ApplicationContext; | ||
import org.springframework.transaction.annotation.EnableTransactionManagement; | ||
|
||
/** | ||
* SprintBootApplication | ||
*/ | ||
@Slf4j | ||
@SpringBootApplication | ||
@EnableAutoConfiguration(exclude = {ErrorMvcAutoConfiguration.class}) | ||
public class BootApplication extends SpringBootServletInitializer { | ||
|
||
@Override | ||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { | ||
return application.sources(BootApplication.class); | ||
} | ||
@EnableCaching | ||
@EnableTransactionManagement | ||
public class BootApplication { | ||
|
||
/** | ||
* @param args | ||
*/ | ||
public static void main(String[] args) { | ||
SpringApplication.run(BootApplication.class, args); | ||
ApplicationContext context = SpringApplication.run(BootApplication.class, args); | ||
String serverPort = context.getEnvironment().getProperty("server.port"); | ||
log.info("mblog started at http://localhost:" + serverPort); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.