Commit 37ee9230 authored by 赵啸非's avatar 赵啸非

证照打印配置

parent 1404aeab
......@@ -22,8 +22,6 @@
<directory>./db</directory>
<includes>
<include>*.sql</include>
<include>service.exe</include>
<include>service.xml</include>
</includes>
<outputDirectory>db</outputDirectory>
<fileMode>0755</fileMode>
......
......@@ -40,7 +40,6 @@
</profile>
<profile>
<id>test</id>
<properties>
<profiles.active>test</profiles.active>
<profiles.server.debug>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=15505</profiles.server.debug>
......@@ -54,6 +53,7 @@
<id>product</id>
<properties>
<profiles.active>product</profiles.active>
<profiles.server.debug>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=15505</profiles.server.debug>
<profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
</properties>
</profile>
......
#!/bin/sh
RETVAL=$?
SHELL_NAME="deploy"
BASEDIR=$(dirname $0)
BASEDIR=$( (
cd "$BASEDIR"
pwd
))
LOCK_FILE="/tmp/deploy.lock"
# 时间变量
CDATE=$(date "+%Y-%m-%d")
CTIME=$(date "+%H:%M:%S")
SHELL_LOG="${BASEDIR}/${SHELL_NAME}.log"
JAVA_HOME="/usr/local/java/jdk1.8"
SERVICE_PATH="/usr/lib/systemd/system"
PUBLISH_PATH="/home/publish"
PROJECT_NAME="@project.artifactId@"
PROJECT_EXECPATH="${PUBLISH_PATH}/${PROJECT_NAME}"
PROJECT_FILENAME="${PROJECT_NAME}.tar.gz"
PROJECT_SERVICE="${SERVICE_PATH}/${PROJECT_NAME}.service"
#写日志
writelog() {
LOGINFO=$1
echo "${CDATE} ${CTIME}: ${SHELL_NAME} : ${LOGINFO}" >>${SHELL_LOG}
echo ${LOGINFO}
}
#清理目标
clear_deploy() {
SERVICE=$1
EXECPATH=$2
#清理后台自启服务
rm -f ${SERVICE}
#清理执行文件目录
}
build_service() {
SERVICE=$1
EXECPATH=$2
echo "" >${SERVICE}
echo "[Unit]" >>${SERVICE}
echo "Description=${PROJECT_NAME}" >>${SERVICE}
echo "After=network.target" >>${SERVICE}
echo "" >>${SERVICE}
echo "[Service]" >>${SERVICE}
echo "Environment=\"JAVA_HOME=$JAVA_HOME\"" >>${SERVICE}
echo "Type=forking" >>${SERVICE}
echo "ExecStartPre=-/bin/sleep 5s" >>${SERVICE}
echo "ExecStart=${EXECPATH}/bin/start.sh" >>${SERVICE}
echo "ExecStop=${EXECPATH}/bin/shutdown.sh" >>${SERVICE}
echo "PrivateTmp=true" >>${SERVICE}
echo "" >>${SERVICE}
echo "[Install]" >>${SERVICE}
echo "WantedBy=multi-user.target" >>${SERVICE}
writelog "${PROJECT_NAME}服务创建完成!"
}
#启动服务与nginx
start_service() {
systemctl enable ${PROJECT_NAME}
systemctl daemon-reload
writelog "${PROJECT_NAME}服务启动..."
systemctl stop ${PROJECT_NAME}&&systemctl start ${PROJECT_NAME}
project_status=$(systemctl status "${PROJECT_NAME}"|grep Active |awk '{print $2}')
jcpid=$(ps -ef | grep -v "grep" | grep "${PROJECT_NAME} " | awk '{print $2}')
writelog "${PROJECT_NAME}服务启动,PID is ${jcpid} ,status:${project_status}"
}
#部署后台服务
project_deploy() {
writelog "${PROJECT_NAME}_deploy"
clear_deploy ${PROJECT_SERVICE} ${PROJECT_EXECPATH}
writelog "${PROJECT_NAME}_clear_finish"
tar -zvxf ./${PROJECT_FILENAME} -C ${PUBLISH_PATH}
build_service ${PROJECT_SERVICE} ${PROJECT_EXECPATH}
start_service
writelog "${PROJECT_NAME}_deploy_finish"
}
#主函数
main() {
echo "后台服务部署"
project_deploy
exit ${RETVAL}
}
main $1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment