1 Star 0 Fork 15

YangMain/logserver

forked from 夏哥/logserver 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
start.sh 2.14 KB
一键复制 编辑 原始数据 按行查看 历史
xlongwei 提交于 2019-11-01 13:00 . logLength=2048
#!/bin/sh
daemon=true
logfile=logs/all.logs
jarfile=target/logserver.jar
[ ! -e "$jarfile" ] && jarfile=logserver.jar
JVM_OPS="-Xmx72m -Xss228k"
JVM_OPS="$JVM_OPS -DcontextName=logserver"
JVM_OPS="$JVM_OPS -DlogLength=2048"
#ENV_OPS="PATH=/usr/java/jdk1.8.0_161/bin:$PATH"
usage(){
echo "Usage: start.sh ( commands ... )"
echo "commands: "
echo " status check the running status"
echo " start start logserver"
echo " stop stop logserver"
echo " restart stop && start"
echo " clean clean target"
echo " build build logserver.jar"
echo " jars copy dependencies to target"
echo " package build logser.jar and copy dependencies to target"
echo " rebuild stop && build && start"
echo " refresh stop && clean && build && jars && start"
echo " deploy package all to one-fat logserver.jar"
}
status(){
PIDS=`ps -ef | grep java | grep "logserver.jar" |awk '{print $2}'`
if [ -z "$PIDS" ]; then
echo "logserver is not running!"
else
for PID in $PIDS ; do
echo "logserver has pid: $PID!"
done
fi
}
stop(){
PIDS=`ps -ef | grep java | grep "logserver.jar" |awk '{print $2}'`
if [ -z "$PIDS" ]; then
echo "logserver is not running!"
else
echo -e "Stopping logserver ..."
for PID in $PIDS ; do
echo -e "kill $PID"
kill $PID > /dev/null 2>&1
done
fi
}
clean(){
mvn clean
}
jar(){
mvn compile jar:jar
}
dependency(){
mvn dependency:copy-dependencies -DoutputDirectory=target
}
deploy(){
mvn package -Prelease
}
start(){
echo "starting logserver ..."
JVM_OPS="-server -Djava.awt.headless=true $JVM_OPS"
ENV_OPS="$ENV_OPS enableHttps=false"
if [ "$daemon" = "true" ]; then
env $ENV_OPS setsid java $JVM_OPS -Dlogfile=$logfile -jar $jarfile >> /dev/null 2>&1 &
else
env $ENV_OPS java $JVM_OPS -jar $jarfile 2>&1
fi
}
if [ $# -eq 0 ]; then
usage
else
case $1 in
status) status ;;
start) start ;;
stop) stop ;;
restart) stop && start ;;
clean) clean ;;
build) jar ;;
jars) dependency ;;
package) jar && dependency ;;
rebuild) stop && jar && start ;;
refresh) stop && clean && jar && dependency && start ;;
deploy) deploy ;;
*) usage ;;
esac
fi
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/yangmain/logserver.git
git@gitee.com:yangmain/logserver.git
yangmain
logserver
logserver
master

搜索帮助