first commit

This commit is contained in:
jerryjzhang
2023-06-12 18:44:01 +08:00
commit dc4fc69b57
879 changed files with 573090 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
export APP_NAME=chat-service
export MAIN_CLASS=com.tencent.supersonic.ChatLauncher

View File

@@ -0,0 +1,38 @@
#!/usr/bin/env bash
binDir=$(cd "$(dirname "$0")"; pwd)
baseDir=$(readlink -f $binDir/../)
libDir=$baseDir/lib
confDir=$baseDir/conf
webDir=$baseDir/webapp
source ${baseDir}/bin/env.sh
CLASSPATH=""
CLASSPATH=$CLASSPATH:$confDir
for jarPath in $libDir/*.jar; do
CLASSPATH=$CLASSPATH:$jarPath
done
export CLASSPATH
export LANG="zh_CN.UTF-8"
cd $baseDir
if [[ "$JAVA_HOME" == "" ]]; then
JAVA_HOME=$(ls /usr/jdk64/jdk* -d 2>/dev/null | xargs | awk '{print "'$APP_NAME'"}')
fi
export PATH=$JAVA_HOME/bin:$PATH
command="-Dfile.encoding="UTF-8" -Duser.language="Zh" -Duser.region="CN" -Duser.timezone="GMT+08" -Xms1024m -Xmx2048m "$MAIN_CLASS
mkdir -p $baseDir/logs
if [[ "$is_test" == "true" ]]; then
java -Dspring.profiles.active="dev" $command >/dev/null 2>$baseDir/logs/error.log &
else
java $command $baseDir >/dev/null 2>$baseDir/logs/error.log &
fi

View File

@@ -0,0 +1,55 @@
#!/usr/bin/env bash
binDir=$(cd "$(dirname "$0")"; pwd)
baseDir=$(readlink -f $binDir/../)
confDir=$baseDir/conf
source ${baseDir}/bin/env.sh
commond=$1
function start()
{
pid=$(ps aux | grep $MAIN_CLASS | grep -v grep |grep $baseDir | awk '{print "'$APP_NAME'"}')
if [[ "$pid" == "" ]]; then
logs=$baseDir/logs/service.sh.log
env DEPLOY=true $baseDir/bin/run.sh $MAIN_CLASS && echo "Process started, see logs/error with logs/error command"
return 0
else
echo "Process (PID = $pid) is running."
return 1
fi
}
function stop()
{
pid=$(ps aux | grep $MAIN_CLASS | grep -v grep|grep $baseDir| awk '{print $2}')
if [[ "$pid" == "" ]]; then
echo "Process is not running !"
return 1
else
kill -9 $pid
echo "Process (PID = $pid) is killed !"
return 0
fi
}
case "$commond" in
start)
echo -e "Starting $APP_NAME"
start
;;
stop)
echo -e "Stopping $APP_NAME"
stop
;;
restart)
echo -e "Resetting $APP_NAME"
stop
start
;;
*)
echo "Use command {start|stop|status|restart} to run."
exit 1
esac
exit 0