Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
OSmall
/
linjiashop
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit db2dc87f
authored
Dec 22, 2020
by
wnb0128
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
环境部署相关修改--think.wang
1 parent
adb2f753
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
758 additions
and
5 deletions
shop-admin-api/pom.xml
shop-admin-api/src/main/resources/application.properties
shop-admin-api/src/main/resources/bootstrap.properties
shop-admin-api/src/main/webapp/WEB-INF/bin/dump.sh
shop-admin-api/src/main/webapp/WEB-INF/bin/restart.sh
shop-admin-api/src/main/webapp/WEB-INF/bin/server.sh
shop-admin-api/src/main/webapp/WEB-INF/bin/start.sh
shop-admin-api/src/main/webapp/WEB-INF/bin/stop.sh
shop-mobile-api/pom.xml
shop-mobile-api/src/main/resources/application.properties
shop-mobile-api/src/main/resources/bootstrap.properties
shop-mobile-api/src/main/webapp/WEB-INF/bin/dump.sh
shop-mobile-api/src/main/webapp/WEB-INF/bin/restart.sh
shop-mobile-api/src/main/webapp/WEB-INF/bin/server.sh
shop-mobile-api/src/main/webapp/WEB-INF/bin/start.sh
shop-mobile-api/src/main/webapp/WEB-INF/bin/stop.sh
shop-admin-api/pom.xml
View file @
db2dc87
...
...
@@ -8,8 +8,8 @@
<version>
1.0.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<packaging>
j
ar
</packaging>
<packaging>
w
ar
</packaging>
<name>
shop-admin-api
</name>
<artifactId>
shop-admin-api
</artifactId>
<version>
1.0.0-SNAPSHOT
</version>
...
...
shop-admin-api/src/main/resources/application.properties
View file @
db2dc87
##\u6253\u5305\u90E8\u7F72\u7684\u65F6\u5019\u5C06\u8BE5\u914D\u7F6E\u66F4\u6539\u4E3Aprod
spring.application.name
=
shop-admin-api
spring.profiles.active
=
dev
server.port
=
8082
server.servlet.context-
path
=
/shop-admin
server.port
=
9402
server.tomcat.max-
threads
=
800
spring.main.allow-bean-definition-
overriding
=
true
spring.jpa.hibernate.use-new-id-generator-
mappings
=
false
...
...
shop-admin-api/src/main/resources/bootstrap.properties
0 → 100644
View file @
db2dc87
File mode changed
shop-admin-api/src/main/webapp/WEB-INF/bin/dump.sh
0 → 100644
View file @
db2dc87
#!/bin/bash
cd
`
dirname
$0
`
BIN_DIR
=
`
pwd
`
cd
..
DEPLOY_DIR
=
`
pwd
`
CONF_DIR
=
$DEPLOY_DIR
/classes
SERVER_NAME
=
`
sed
'/application.name/!d;s/.*=//'
classes/config/application.properties | tr -d
'\r'
`
#LOGS_FILE=`sed '/log4j.appender.logToFile.File/!d;s/.*=//' classes/log4j.properties | tr -d '\r'`
LOGS_FILE
=
`
sed
'/name="LOG_PATH"/!d;s/.*value="\(.*\)".*/\1/g'
classes/logback.xml
`
if
[
-z
"
$SERVER_NAME
"
]
;
then
SERVER_NAME
=
`
hostname
`
fi
PIDS
=
`
ps --no-heading -C java -f --width 1000 | grep
"
$CONF_DIR
"
|awk
'{print $2}'
`
if
[
-z
"
$PIDS
"
]
;
then
echo
"ERROR: The
$SERVER_NAME
does not started!"
exit
1
fi
LOGS_DIR
=
""
if
[
-n
"
$LOGS_FILE
"
]
;
then
LOGS_DIR
=
`
dirname
$LOGS_FILE
`
else
LOGS_DIR
=
$DEPLOY_DIR
/logs
fi
if
[
! -d
$LOGS_DIR
]
;
then
mkdir
$LOGS_DIR
fi
DUMP_DIR
=
$LOGS_DIR
/dump
if
[
! -d
$DUMP_DIR
]
;
then
mkdir
$DUMP_DIR
fi
DUMP_DATE
=
`
date +%Y%m%d%H%M%S
`
DATE_DIR
=
$DUMP_DIR
/
$DUMP_DATE
if
[
! -d
$DATE_DIR
]
;
then
mkdir
$DATE_DIR
fi
echo
-e
"Dumping the
$SERVER_NAME
...
\c
"
for
PID
in
$PIDS
;
do
jstack
$PID
>
$DATE_DIR
/jstack-
$PID
.dump 2>&1
echo
-e
".
\c
"
jinfo
$PID
>
$DATE_DIR
/jinfo-
$PID
.dump 2>&1
echo
-e
".
\c
"
jstat -gcutil
$PID
>
$DATE_DIR
/jstat-gcutil-
$PID
.dump 2>&1
echo
-e
".
\c
"
jstat -gccapacity
$PID
>
$DATE_DIR
/jstat-gccapacity-
$PID
.dump 2>&1
echo
-e
".
\c
"
jmap
$PID
>
$DATE_DIR
/jmap-
$PID
.dump 2>&1
echo
-e
".
\c
"
jmap -heap
$PID
>
$DATE_DIR
/jmap-heap-
$PID
.dump 2>&1
echo
-e
".
\c
"
jmap -histo
$PID
>
$DATE_DIR
/jmap-histo-
$PID
.dump 2>&1
echo
-e
".
\c
"
if
[
-r /usr/sbin/lsof
]
;
then
/usr/sbin/lsof -p
$PID
>
$DATE_DIR
/lsof-
$PID
.dump
echo
-e
".
\c
"
fi
done
if
[
-r /bin/netstat
]
;
then
/bin/netstat -an >
$DATE_DIR
/netstat.dump 2>&1
echo
-e
".
\c
"
fi
if
[
-r /usr/bin/iostat
]
;
then
/usr/bin/iostat >
$DATE_DIR
/iostat.dump 2>&1
echo
-e
".
\c
"
fi
if
[
-r /usr/bin/mpstat
]
;
then
/usr/bin/mpstat >
$DATE_DIR
/mpstat.dump 2>&1
echo
-e
".
\c
"
fi
if
[
-r /usr/bin/vmstat
]
;
then
/usr/bin/vmstat >
$DATE_DIR
/vmstat.dump 2>&1
echo
-e
".
\c
"
fi
if
[
-r /usr/bin/free
]
;
then
/usr/bin/free -t >
$DATE_DIR
/free.dump 2>&1
echo
-e
".
\c
"
fi
if
[
-r /usr/bin/sar
]
;
then
/usr/bin/sar >
$DATE_DIR
/sar.dump 2>&1
echo
-e
".
\c
"
fi
if
[
-r /usr/bin/uptime
]
;
then
/usr/bin/uptime >
$DATE_DIR
/uptime.dump 2>&1
echo
-e
".
\c
"
fi
echo
"OK!"
echo
"DUMP:
$DATE_DIR
"
shop-admin-api/src/main/webapp/WEB-INF/bin/restart.sh
0 → 100644
View file @
db2dc87
#!/bin/bash
cd
`
dirname
$0
`
./stop.sh
if
[
!
$?
-eq 2
]
;
then
./start.sh
fi
\ No newline at end of file
shop-admin-api/src/main/webapp/WEB-INF/bin/server.sh
0 → 100644
View file @
db2dc87
#!/bin/bash
cd
`
dirname
$0
`
if
[
"
$1
"
=
"start"
]
;
then
ENV
=
$2
if
[
-z
"
$ENV
"
]
;
then
echo
"ERROR:PLEASE SPEC ENV ARGS,SUCH AS dev,test,beta,release.. "
echo
"app exit"
exit
1
fi
./start.sh
$ENV
else
if
[
"
$1
"
=
"stop"
]
;
then
./stop.sh
else
if
[
"
$1
"
=
"debug"
]
;
then
ENV
=
$2
if
[
-z
"
$ENV
"
]
;
then
echo
"ERROR:PLEASE SPEC ENV ARGS,SUCH AS dev,test,beta,release.. "
echo
"app exit"
exit
1
fi
./start.sh
$ENV
debug
else
if
[
"
$1
"
=
"restart"
]
;
then
ENV
=
$2
if
[
-z
"
$ENV
"
]
;
then
echo
"ERROR:PLEASE SPEC ENV ARGS,SUCH AS dev,test,beta,release.. "
echo
"app exit"
exit
1
fi
./restart.sh
$ENV
else
if
[
"
$1
"
=
"dump"
]
;
then
./dump.sh
else
echo
"ERROR: Please input argument: start or stop or debug or restart or dump"
exit
1
fi
fi
fi
fi
fi
shop-admin-api/src/main/webapp/WEB-INF/bin/start.sh
0 → 100644
View file @
db2dc87
#!/bin/bash
####################################
# #
# General shell v1.0.0.1 #
# #
# #
####################################
###########init variable#############
JAVA_HOME
=
"/app/soft/jdk1.8.0_144"
SERVER_PORT
=
"8094"
DUBBO_PORT
=
""
JMX_ARG
=
"-Xmx1024m -Xms512m -Xmn256m"
MAIN
=
"com.glsx.shop.api.AdminApiApplication"
SERVER_NAME
=
"shop-admin-api"
###########end#######################
PID_DIR
=
"/app/soft/java_project/pids"
cd
`
dirname
$0
`
BIN_DIR
=
`
pwd
`
cd
..
if
[
-d
"classes"
]
;
then
CONF_DIR
=
"
$(
pwd
)
/classes"
LIB_DIR
=
"
$(
pwd
)
/lib"
elif
[
-d
"conf"
]
;
then
CONF_DIR
=
"
$(
pwd
)
/conf"
LIB_DIR
=
"
$(
pwd
)
/lib"
fi
LIB_JARS
=
`
ls
$LIB_DIR
|grep .jar|awk
'{print "'
$LIB_DIR
'/"$0}'
|tr
"
\n
"
":"
`
export
CLASSPATH
=
$CONF_DIR
:
$LIB_JARS
if
[
-z
"
$CONF_DIR
"
]
;
then
echo
"Configure dir not found"
exit
1
fi
PIDS
=
`
ps --no-heading -C java -f --width 1000 | grep
"
$CONF_DIR
"
|awk
'{print $2}'
`
if
[
-n
"
$PIDS
"
]
;
then
echo
"ERROR: The app is already started!"
echo
"PID:
$PIDS
"
exit
1
fi
if
[
! -d
"
$PID_DIR
"
]
;
then
mkdir -p
$PID_DIR
fi
CHECK_PORT
=
$2
if
[
-n
"
$SERVER_PORT
"
]
;
then
SERVER_PORT_COUNT
=
`
netstat -tln | grep -w
$SERVER_PORT
| wc -l
`
if
[
$SERVER_PORT_COUNT
-gt 0
]
;
then
echo
"ERROR: The port
$SERVER_PORT
is already used!"
exit
1
fi
fi
if
[
-n
"
$DUBBO_PORT
"
]
;
then
DUBBO_PORT_COUNT
=
`
netstat -tln | grep -w
$DUBBO_PORT
| wc -l
`
if
[
$DUBBO_PORT_COUNT
-gt 0
]
;
then
echo
"ERROR: The port
$DUBBO_PORT
already used!"
exit
1
fi
fi
if
[[
-z
"
$SERVER_PORT
"
&&
-z
"
$DUBBO_PORT
"
]]
;
then
CHECK_PORT
=
"skip"
fi
LOG_FILE
=
"/data/java_log/jetty/
${
SERVER_NAME
}
/
${
SERVER_NAME
}
.log"
LOG_DIR
=
`
dirname
$LOG_FILE
`
if
[
! -d
$LOG_DIR
]
;
then
mkdir -p
$LOG_DIR
fi
############java args #######
#JAVA_OPTS="$PINPOINT -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Ddubbo.registry.file=/home/jdkapp/.dubbo/${SERVER_NAME}.cache"
JAVA_OPTS
=
"
$PINPOINT
-Djava.awt.headless=true -Djava.net.preferIPv4Stack=true"
#JAVA_OPTS=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true"
JAVA_DEBUG_OPTS
=
""
if
[
"
$2
"
=
"debug"
]
;
then
JAVA_DEBUG_OPTS
=
" -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n "
fi
JAVA_JMX_OPTS
=
""
if
[
"
$2
"
=
"jmx"
]
;
then
JAVA_JMX_OPTS
=
" -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false "
fi
BITS
=
`
file
$JAVA_HOME
/bin/java | grep 64-bit
`
if
[
-n
"
$BITS
"
]
;
then
if
[
-n
"
$JMX_ARG
"
]
;
then
JAVA_MEM_OPTS
=
"-server
$JMX_ARG
-XX:PermSize=128m -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70"
else
JAVA_MEM_OPTS
=
" -server -Xmx1g -Xms1g -Xmn256m -XX:PermSize=128m -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 "
fi
else
JAVA_MEM_OPTS
=
" -server -Xms1024m -Xmx1024m -XX:PermSize=128m -XX:SurvivorRatio=2 -XX:+UseParallelGC "
fi
echo
-e
"Starting
$SERVER_NAME
\c
"
nohup
$JAVA_HOME
/bin/java
$JAVA_OPTS
$JAVA_MEM_OPTS
$JAVA_DEBUG_OPTS
$JAVA_JMX_OPTS
-DCLASS_DIR
=
$CONF_DIR
:
$LIB_DIR
$MAIN
> /dev/null 2>&1 &
PIDS
=
$!
if
[
"
$CHECK_PORT
"
!
=
"skip"
]
;
then
COUNT
=
0
ERROR
=
0
TIME_OUT
=
60
ctime
=
`
date +
"%s"
`
while
[
$COUNT
-lt 1
]
;
do
ctime2
=
`
date +
"%s"
`
echo
-e
".
\c
"
sleep 1
#PIDS=`ps --no-heading -C java -f --width 1000 | grep "$CONF_DIR" | awk '{print $2}'`
RESULT
=
`
ps --no-heading -p
$PIDS
`
if
[
-n
"
$RESULT
"
]
;
then
if
[
-n
"
$DUBBO_PORT
"
]
;
then
#COUNT=`echo status | nc 127.0.0.1 $DUBBO_PORT -i 1 | grep -c OK`
COUNT
=
`
/usr/sbin/ss -lpn | grep
"
${
DUBBO_PORT
}
.*
$PIDS
"
| wc -l
`
else
if
[
-n
"
$SERVER_PORT
"
]
;
then
#COUNT=`netstat -ntl | grep -w $SERVER_PORT | wc -l`
COUNT
=
`
/usr/sbin/ss -lpn | grep
"
${
SERVER_PORT
}
.*
$PIDS
"
| wc -l
`
fi
fi
if
[
$COUNT
-gt 0
]
;
then
echo
$PIDS
>
$PID_DIR
/
${
SERVER_NAME
}
.pid
break
fi
dtime
=
$((
ctime2
-
ctime
))
if
[
"
$dtime
"
-ge
"
$TIME_OUT
"
]
;
then
echo
$PIDS
>
$PID_DIR
/
${
SERVER_NAME
}
.pid
echo
-e
"
\n
check port status timeout"
exit
1
fi
else
ERROR
=
$((
ERROR
+
1
))
if
[
"
$ERROR
"
-gt 3
]
;
then
echo
-e
"
\n
Program startup failed"
exit
2
fi
fi
done
fi
#服务检测与注册
if
[[
"x
$SERVER_PORT
"
!
=
"x"
&&
-f ./bin/check.sh
]]
then
./bin/check.sh
$SERVER_NAME
$SERVER_PORT
$PIDS
&
fi
echo
"PID:
$PIDS
"
echo
"LOGFILE:
$LOG_FILE
"
\ No newline at end of file
shop-admin-api/src/main/webapp/WEB-INF/bin/stop.sh
0 → 100644
View file @
db2dc87
#!/bin/bash
####################################
# #
# General shell v1.0.0.1 #
# #
# #
####################################
SERVER_NAME
=
"shop-admin-api"
PID_DIR
=
"/app/soft/java_project/pids"
cd
`
dirname
$0
`
BIN_DIR
=
`
pwd
`
cd
..
if
[
-d
"classes"
]
;
then
CONF_DIR
=
"
$(
pwd
)
/classes"
elif
[
-d
"conf"
]
;
then
CONF_DIR
=
"
$(
pwd
)
/conf"
fi
#if [ -f "$PID_DIR/${SERVER_NAME}.pid" ];then
# PID=`cat $PID_DIR/${SERVER_NAME}.pid`
#else
PID
=
`
ps --no-heading -C java -f --width 1000 | grep
"
$CONF_DIR
"
|awk
'{print $2}'
`
#fi
if
[
-z
"
$PID
"
]
;
then
echo
"The program is not running"
exit
1
fi
pcount
=
`
ps --no-heading -p
$PID
| wc -l
`
if
[
"
$pcount
"
-ne 1
]
;
then
echo
"ERROR:
$SERVER_NAME
does not started!"
exit
1
fi
echo
-e
"Stopping
$SERVER_NAME
...
\c
"
kill
$PID
> /dev/null 2>&1
COUNT
=
0
ctime
=
`
date +
"%s"
`
while
[
$COUNT
-lt 1
]
;
do
echo
-e
".
\c
"
sleep 1
COUNT
=
1
PID_EXIST
=
`
ps --no-heading -p
$PID
`
if
[
-n
"
$PID_EXIST
"
]
;
then
ctime2
=
`
date +
"%s"
`
dtime
=
$((
ctime2
-
ctime
))
if
[
"
$dtime
"
-ge 10
]
;
then
echo
-e
"
\n
stop program timeout, use kill -9
$PID
"
kill
-9
$PID
>/dev/null 2>&1
if
[
!
$?
-eq 0
]
;
then
echo
"No permissions"
exit
2
else
rm -rf
$PID_DIR
/
${
SERVER_NAME
}
.pid
fi
fi
COUNT
=
0
continue
fi
done
echo
"OK!"
rm -rf
$PID_DIR
/
${
SERVER_NAME
}
.pid
\ No newline at end of file
shop-mobile-api/pom.xml
View file @
db2dc87
...
...
@@ -8,7 +8,8 @@
<version>
1.0.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<packaging>
jar
</packaging>
<packaging>
war
</packaging>
<name>
shop-mobile-api
</name>
<artifactId>
shop-mobile-api
</artifactId>
<version>
1.0.0-SNAPSHOT
</version>
...
...
shop-mobile-api/src/main/resources/application.properties
View file @
db2dc87
##\u6253\u5305\u90E8\u7F72\u7684\u65F6\u5019\u5C06\u8BE5\u914D\u7F6E\u66F4\u6539\u4E3Aprod
spring.application.name
=
shop-mobile-api
spring.profiles.active
=
dev
server.port
=
8081
server.servlet.context-
path
=
/shop-app
server.port
=
8209
server.tomcat.max-
threads
=
800
spring.main.allow-bean-definition-
overriding
=
true
spring.jpa.hibernate.use-new-id-generator-
mappings
=
false
...
...
shop-mobile-api/src/main/resources/bootstrap.properties
0 → 100644
View file @
db2dc87
File mode changed
shop-mobile-api/src/main/webapp/WEB-INF/bin/dump.sh
0 → 100644
View file @
db2dc87
#!/bin/bash
cd
`
dirname
$0
`
BIN_DIR
=
`
pwd
`
cd
..
DEPLOY_DIR
=
`
pwd
`
CONF_DIR
=
$DEPLOY_DIR
/classes
SERVER_NAME
=
`
sed
'/application.name/!d;s/.*=//'
classes/config/application.properties | tr -d
'\r'
`
#LOGS_FILE=`sed '/log4j.appender.logToFile.File/!d;s/.*=//' classes/log4j.properties | tr -d '\r'`
LOGS_FILE
=
`
sed
'/name="LOG_PATH"/!d;s/.*value="\(.*\)".*/\1/g'
classes/logback.xml
`
if
[
-z
"
$SERVER_NAME
"
]
;
then
SERVER_NAME
=
`
hostname
`
fi
PIDS
=
`
ps --no-heading -C java -f --width 1000 | grep
"
$CONF_DIR
"
|awk
'{print $2}'
`
if
[
-z
"
$PIDS
"
]
;
then
echo
"ERROR: The
$SERVER_NAME
does not started!"
exit
1
fi
LOGS_DIR
=
""
if
[
-n
"
$LOGS_FILE
"
]
;
then
LOGS_DIR
=
`
dirname
$LOGS_FILE
`
else
LOGS_DIR
=
$DEPLOY_DIR
/logs
fi
if
[
! -d
$LOGS_DIR
]
;
then
mkdir
$LOGS_DIR
fi
DUMP_DIR
=
$LOGS_DIR
/dump
if
[
! -d
$DUMP_DIR
]
;
then
mkdir
$DUMP_DIR
fi
DUMP_DATE
=
`
date +%Y%m%d%H%M%S
`
DATE_DIR
=
$DUMP_DIR
/
$DUMP_DATE
if
[
! -d
$DATE_DIR
]
;
then
mkdir
$DATE_DIR
fi
echo
-e
"Dumping the
$SERVER_NAME
...
\c
"
for
PID
in
$PIDS
;
do
jstack
$PID
>
$DATE_DIR
/jstack-
$PID
.dump 2>&1
echo
-e
".
\c
"
jinfo
$PID
>
$DATE_DIR
/jinfo-
$PID
.dump 2>&1
echo
-e
".
\c
"
jstat -gcutil
$PID
>
$DATE_DIR
/jstat-gcutil-
$PID
.dump 2>&1
echo
-e
".
\c
"
jstat -gccapacity
$PID
>
$DATE_DIR
/jstat-gccapacity-
$PID
.dump 2>&1
echo
-e
".
\c
"
jmap
$PID
>
$DATE_DIR
/jmap-
$PID
.dump 2>&1
echo
-e
".
\c
"
jmap -heap
$PID
>
$DATE_DIR
/jmap-heap-
$PID
.dump 2>&1
echo
-e
".
\c
"
jmap -histo
$PID
>
$DATE_DIR
/jmap-histo-
$PID
.dump 2>&1
echo
-e
".
\c
"
if
[
-r /usr/sbin/lsof
]
;
then
/usr/sbin/lsof -p
$PID
>
$DATE_DIR
/lsof-
$PID
.dump
echo
-e
".
\c
"
fi
done
if
[
-r /bin/netstat
]
;
then
/bin/netstat -an >
$DATE_DIR
/netstat.dump 2>&1
echo
-e
".
\c
"
fi
if
[
-r /usr/bin/iostat
]
;
then
/usr/bin/iostat >
$DATE_DIR
/iostat.dump 2>&1
echo
-e
".
\c
"
fi
if
[
-r /usr/bin/mpstat
]
;
then
/usr/bin/mpstat >
$DATE_DIR
/mpstat.dump 2>&1
echo
-e
".
\c
"
fi
if
[
-r /usr/bin/vmstat
]
;
then
/usr/bin/vmstat >
$DATE_DIR
/vmstat.dump 2>&1
echo
-e
".
\c
"
fi
if
[
-r /usr/bin/free
]
;
then
/usr/bin/free -t >
$DATE_DIR
/free.dump 2>&1
echo
-e
".
\c
"
fi
if
[
-r /usr/bin/sar
]
;
then
/usr/bin/sar >
$DATE_DIR
/sar.dump 2>&1
echo
-e
".
\c
"
fi
if
[
-r /usr/bin/uptime
]
;
then
/usr/bin/uptime >
$DATE_DIR
/uptime.dump 2>&1
echo
-e
".
\c
"
fi
echo
"OK!"
echo
"DUMP:
$DATE_DIR
"
shop-mobile-api/src/main/webapp/WEB-INF/bin/restart.sh
0 → 100644
View file @
db2dc87
#!/bin/bash
cd
`
dirname
$0
`
./stop.sh
if
[
!
$?
-eq 2
]
;
then
./start.sh
fi
\ No newline at end of file
shop-mobile-api/src/main/webapp/WEB-INF/bin/server.sh
0 → 100644
View file @
db2dc87
#!/bin/bash
cd
`
dirname
$0
`
if
[
"
$1
"
=
"start"
]
;
then
ENV
=
$2
if
[
-z
"
$ENV
"
]
;
then
echo
"ERROR:PLEASE SPEC ENV ARGS,SUCH AS dev,test,beta,release.. "
echo
"app exit"
exit
1
fi
./start.sh
$ENV
else
if
[
"
$1
"
=
"stop"
]
;
then
./stop.sh
else
if
[
"
$1
"
=
"debug"
]
;
then
ENV
=
$2
if
[
-z
"
$ENV
"
]
;
then
echo
"ERROR:PLEASE SPEC ENV ARGS,SUCH AS dev,test,beta,release.. "
echo
"app exit"
exit
1
fi
./start.sh
$ENV
debug
else
if
[
"
$1
"
=
"restart"
]
;
then
ENV
=
$2
if
[
-z
"
$ENV
"
]
;
then
echo
"ERROR:PLEASE SPEC ENV ARGS,SUCH AS dev,test,beta,release.. "
echo
"app exit"
exit
1
fi
./restart.sh
$ENV
else
if
[
"
$1
"
=
"dump"
]
;
then
./dump.sh
else
echo
"ERROR: Please input argument: start or stop or debug or restart or dump"
exit
1
fi
fi
fi
fi
fi
shop-mobile-api/src/main/webapp/WEB-INF/bin/start.sh
0 → 100644
View file @
db2dc87
#!/bin/bash
####################################
# #
# General shell v1.0.0.1 #
# #
# #
####################################
###########init variable#############
JAVA_HOME
=
"/app/soft/jdk1.8.0_144"
SERVER_PORT
=
"8092"
DUBBO_PORT
=
""
JMX_ARG
=
"-Xmx1024m -Xms512m -Xmn256m"
MAIN
=
"com.glsx.shop.MobileApiApplication"
SERVER_NAME
=
"shop-mobile-api"
###########end#######################
PID_DIR
=
"/app/soft/java_project/pids"
cd
`
dirname
$0
`
BIN_DIR
=
`
pwd
`
cd
..
if
[
-d
"classes"
]
;
then
CONF_DIR
=
"
$(
pwd
)
/classes"
LIB_DIR
=
"
$(
pwd
)
/lib"
elif
[
-d
"conf"
]
;
then
CONF_DIR
=
"
$(
pwd
)
/conf"
LIB_DIR
=
"
$(
pwd
)
/lib"
fi
LIB_JARS
=
`
ls
$LIB_DIR
|grep .jar|awk
'{print "'
$LIB_DIR
'/"$0}'
|tr
"
\n
"
":"
`
export
CLASSPATH
=
$CONF_DIR
:
$LIB_JARS
if
[
-z
"
$CONF_DIR
"
]
;
then
echo
"Configure dir not found"
exit
1
fi
PIDS
=
`
ps --no-heading -C java -f --width 1000 | grep
"
$CONF_DIR
"
|awk
'{print $2}'
`
if
[
-n
"
$PIDS
"
]
;
then
echo
"ERROR: The app is already started!"
echo
"PID:
$PIDS
"
exit
1
fi
if
[
! -d
"
$PID_DIR
"
]
;
then
mkdir -p
$PID_DIR
fi
CHECK_PORT
=
$2
if
[
-n
"
$SERVER_PORT
"
]
;
then
SERVER_PORT_COUNT
=
`
netstat -tln | grep -w
$SERVER_PORT
| wc -l
`
if
[
$SERVER_PORT_COUNT
-gt 0
]
;
then
echo
"ERROR: The port
$SERVER_PORT
is already used!"
exit
1
fi
fi
if
[
-n
"
$DUBBO_PORT
"
]
;
then
DUBBO_PORT_COUNT
=
`
netstat -tln | grep -w
$DUBBO_PORT
| wc -l
`
if
[
$DUBBO_PORT_COUNT
-gt 0
]
;
then
echo
"ERROR: The port
$DUBBO_PORT
already used!"
exit
1
fi
fi
if
[[
-z
"
$SERVER_PORT
"
&&
-z
"
$DUBBO_PORT
"
]]
;
then
CHECK_PORT
=
"skip"
fi
LOG_FILE
=
"/data/java_log/jetty/
${
SERVER_NAME
}
/
${
SERVER_NAME
}
.log"
LOG_DIR
=
`
dirname
$LOG_FILE
`
if
[
! -d
$LOG_DIR
]
;
then
mkdir -p
$LOG_DIR
fi
############java args #######
#JAVA_OPTS="$PINPOINT -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Ddubbo.registry.file=/home/jdkapp/.dubbo/${SERVER_NAME}.cache"
JAVA_OPTS
=
"
$PINPOINT
-Djava.awt.headless=true -Djava.net.preferIPv4Stack=true"
#JAVA_OPTS=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true"
JAVA_DEBUG_OPTS
=
""
if
[
"
$2
"
=
"debug"
]
;
then
JAVA_DEBUG_OPTS
=
" -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n "
fi
JAVA_JMX_OPTS
=
""
if
[
"
$2
"
=
"jmx"
]
;
then
JAVA_JMX_OPTS
=
" -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false "
fi
BITS
=
`
file
$JAVA_HOME
/bin/java | grep 64-bit
`
if
[
-n
"
$BITS
"
]
;
then
if
[
-n
"
$JMX_ARG
"
]
;
then
JAVA_MEM_OPTS
=
"-server
$JMX_ARG
-XX:PermSize=128m -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70"
else
JAVA_MEM_OPTS
=
" -server -Xmx1g -Xms1g -Xmn256m -XX:PermSize=128m -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 "
fi
else
JAVA_MEM_OPTS
=
" -server -Xms1024m -Xmx1024m -XX:PermSize=128m -XX:SurvivorRatio=2 -XX:+UseParallelGC "
fi
echo
-e
"Starting
$SERVER_NAME
\c
"
nohup
$JAVA_HOME
/bin/java
$JAVA_OPTS
$JAVA_MEM_OPTS
$JAVA_DEBUG_OPTS
$JAVA_JMX_OPTS
-DCLASS_DIR
=
$CONF_DIR
:
$LIB_DIR
$MAIN
> /dev/null 2>&1 &
PIDS
=
$!
if
[
"
$CHECK_PORT
"
!
=
"skip"
]
;
then
COUNT
=
0
ERROR
=
0
TIME_OUT
=
60
ctime
=
`
date +
"%s"
`
while
[
$COUNT
-lt 1
]
;
do
ctime2
=
`
date +
"%s"
`
echo
-e
".
\c
"
sleep 1
#PIDS=`ps --no-heading -C java -f --width 1000 | grep "$CONF_DIR" | awk '{print $2}'`
RESULT
=
`
ps --no-heading -p
$PIDS
`
if
[
-n
"
$RESULT
"
]
;
then
if
[
-n
"
$DUBBO_PORT
"
]
;
then
#COUNT=`echo status | nc 127.0.0.1 $DUBBO_PORT -i 1 | grep -c OK`
COUNT
=
`
/usr/sbin/ss -lpn | grep
"
${
DUBBO_PORT
}
.*
$PIDS
"
| wc -l
`
else
if
[
-n
"
$SERVER_PORT
"
]
;
then
#COUNT=`netstat -ntl | grep -w $SERVER_PORT | wc -l`
COUNT
=
`
/usr/sbin/ss -lpn | grep
"
${
SERVER_PORT
}
.*
$PIDS
"
| wc -l
`
fi
fi
if
[
$COUNT
-gt 0
]
;
then
echo
$PIDS
>
$PID_DIR
/
${
SERVER_NAME
}
.pid
break
fi
dtime
=
$((
ctime2
-
ctime
))
if
[
"
$dtime
"
-ge
"
$TIME_OUT
"
]
;
then
echo
$PIDS
>
$PID_DIR
/
${
SERVER_NAME
}
.pid
echo
-e
"
\n
check port status timeout"
exit
1
fi
else
ERROR
=
$((
ERROR
+
1
))
if
[
"
$ERROR
"
-gt 3
]
;
then
echo
-e
"
\n
Program startup failed"
exit
2
fi
fi
done
fi
#服务检测与注册
if
[[
"x
$SERVER_PORT
"
!
=
"x"
&&
-f ./bin/check.sh
]]
then
./bin/check.sh
$SERVER_NAME
$SERVER_PORT
$PIDS
&
fi
echo
"PID:
$PIDS
"
echo
"LOGFILE:
$LOG_FILE
"
\ No newline at end of file
shop-mobile-api/src/main/webapp/WEB-INF/bin/stop.sh
0 → 100644
View file @
db2dc87
#!/bin/bash
####################################
# #
# General shell v1.0.0.1 #
# #
# #
####################################
SERVER_NAME
=
"shop-mobile-api"
PID_DIR
=
"/app/soft/java_project/pids"
cd
`
dirname
$0
`
BIN_DIR
=
`
pwd
`
cd
..
if
[
-d
"classes"
]
;
then
CONF_DIR
=
"
$(
pwd
)
/classes"
elif
[
-d
"conf"
]
;
then
CONF_DIR
=
"
$(
pwd
)
/conf"
fi
#if [ -f "$PID_DIR/${SERVER_NAME}.pid" ];then
# PID=`cat $PID_DIR/${SERVER_NAME}.pid`
#else
PID
=
`
ps --no-heading -C java -f --width 1000 | grep
"
$CONF_DIR
"
|awk
'{print $2}'
`
#fi
if
[
-z
"
$PID
"
]
;
then
echo
"The program is not running"
exit
1
fi
pcount
=
`
ps --no-heading -p
$PID
| wc -l
`
if
[
"
$pcount
"
-ne 1
]
;
then
echo
"ERROR:
$SERVER_NAME
does not started!"
exit
1
fi
echo
-e
"Stopping
$SERVER_NAME
...
\c
"
kill
$PID
> /dev/null 2>&1
COUNT
=
0
ctime
=
`
date +
"%s"
`
while
[
$COUNT
-lt 1
]
;
do
echo
-e
".
\c
"
sleep 1
COUNT
=
1
PID_EXIST
=
`
ps --no-heading -p
$PID
`
if
[
-n
"
$PID_EXIST
"
]
;
then
ctime2
=
`
date +
"%s"
`
dtime
=
$((
ctime2
-
ctime
))
if
[
"
$dtime
"
-ge 10
]
;
then
echo
-e
"
\n
stop program timeout, use kill -9
$PID
"
kill
-9
$PID
>/dev/null 2>&1
if
[
!
$?
-eq 0
]
;
then
echo
"No permissions"
exit
2
else
rm -rf
$PID_DIR
/
${
SERVER_NAME
}
.pid
fi
fi
COUNT
=
0
continue
fi
done
echo
"OK!"
rm -rf
$PID_DIR
/
${
SERVER_NAME
}
.pid
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment