脚本说明

This commit is contained in:
jinyu 2016-05-22 10:50:04 +08:00
parent 371b226a9b
commit 816a4ec0ef
3 changed files with 22 additions and 21 deletions

View File

@ -1,4 +1,4 @@
<!-- zip可执行包 --> <!-- maven-assembly-plugin:zip可执行包 -->
<assembly <assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Ant远程部署脚本 -->
<project name="weixin4j-server" default="deploy" basedir="."> <project name="weixin4j-server" default="deploy" basedir=".">
<property name="app.dir" value="./target" /> <property name="app.dir" value="./target" />
<property name="zip.name" value="zip包名称,如:weixin4j-server-bin.zip" /> <property name="zip.name" value="zip包名称,如:weixin4j-server-bin.zip" />

View File

@ -1,18 +1,18 @@
# Jar执行脚本 # Jar包服务执行脚本
ulimit -n 110000 ulimit -n 110000
#Jdk home #Jdk home
JAVA_HOME="/usr/local/java" JAVA_HOME="/path/to/java"
#Executing user #Executing user
RUNNING_USER=root RUNNING_USER=root
#App home #App home
APP_HOME="/path/to/weixin4j/service" APP_HOME="/path/to/weixin4j/service"
#Main class #Main class
APP_MAINCLASS=xx.xxx.mainClass.fullName APP_MAINCLASS=xx.xxx.mainClass
#classpath #classpath
CLASSPATH=$APP_HOME/classes CLASSPATH=$APP_HOME/classes
for i in "$APP_HOME"/lib/*.jar; do for i in "$APP_HOME"/lib/*.jar; do
@ -20,29 +20,29 @@ for i in "$APP_HOME"/lib/*.jar; do
done done
CLASSPATH="$CLASSPATH":"$APP_HOME"/conf CLASSPATH="$CLASSPATH":"$APP_HOME"/conf
#jvm options #jvm options
JAVA_OPTS="-Xms256m -Xmx512m -Djava.awt.headless=true -XX:MaxPermSize=128m -server -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=85 -XX:+DisableExplicitGC -Xnoclassgc -Xverify:none" JAVA_OPTS="-Xms256m -Xmx512m -Djava.awt.headless=true -XX:MaxPermSize=128m -server -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=85 -XX:+DisableExplicitGC -Xnoclassgc -Xverify:none"
#psid #psid
psid=0 psid=0
checkpid() { checkpid() {
javaps=`$JAVA_HOME/bin/jps -l | grep $APP_MAINCLASS` javaps=`$JAVA_HOME/bin/jps -l | grep $APP_MAINCLASS`
if [ -n "$javaps" ]; then if [ -n "$javaps" ]; then
psid=`echo $javaps | awk '{print $1}'` psid=`echo $javaps | awk '{print $1}'`
else else
psid=0 psid=0
fi fi
} }
################################### ###################################
#startup #startup
################################### ###################################
start() { start() {
checkpid checkpid
if [ $psid -ne 0 ]; then if [ $psid -ne 0 ]; then
echo "================================" echo "================================"
echo "warn: $APP_MAINCLASS already started! (pid=$psid)" echo "warn: $APP_MAINCLASS already started! (pid=$psid)"
@ -60,13 +60,13 @@ start() {
fi fi
fi fi
} }
################################### ###################################
#stop #stop
################################### ###################################
stop() { stop() {
checkpid checkpid
if [ $psid -ne 0 ]; then if [ $psid -ne 0 ]; then
echo -n "Stopping $APP_MAINCLASS ...(pid=$psid) " echo -n "Stopping $APP_MAINCLASS ...(pid=$psid) "
su - $RUNNING_USER -c "kill -9 $psid" su - $RUNNING_USER -c "kill -9 $psid"
@ -75,7 +75,7 @@ stop() {
else else
echo "[Failed]" echo "[Failed]"
fi fi
checkpid checkpid
if [ $psid -ne 0 ]; then if [ $psid -ne 0 ]; then
stop stop
@ -86,20 +86,20 @@ stop() {
echo "================================" echo "================================"
fi fi
} }
################################### ###################################
#status #status
################################### ###################################
status() { status() {
checkpid checkpid
if [ $psid -ne 0 ]; then if [ $psid -ne 0 ]; then
echo "$APP_MAINCLASS is running! (pid=$psid)" echo "$APP_MAINCLASS is running! (pid=$psid)"
else else
echo "$APP_MAINCLASS is not running" echo "$APP_MAINCLASS is not running"
fi fi
} }
################################### ###################################
#info #info
################################### ###################################
@ -116,7 +116,7 @@ info() {
echo "APP_MAINCLASS=$APP_MAINCLASS" echo "APP_MAINCLASS=$APP_MAINCLASS"
echo "****************************" echo "****************************"
} }
################################### ###################################
#access only 1 argument:{start|stop|restart|status|info} #access only 1 argument:{start|stop|restart|status|info}
################################### ###################################