# go服务
代码语言:javascript
复制#!/bin/bash
pid=(`pidof version_manager_service`)
if [ -n $pid ]; then
kill -9 $pid
fi
sleep 2
out_name="service_out"_`date '%Y%m%d'`.log
nohup ./bin/version_manager_service >> ./log/${out_name} 2>&1 &
# java服务
代码语言:javascript
复制#!/bin/bash
export JAVA_HOME=/usr/local/jdk1.8.0_201
PATH=$PATH:$JAVA_HOME/bin
NAME=$1
VERSION=$2
PORT=$3
logbk=`date " %Y%m%d_%H%M"`
echo $NAME
ID=`ps -ef | grep "$NAME" | grep -v "$0" | grep -v "grep" | awk '{print $2}'`
if [ ! $NAME ]; then
echo "执行失败,请添加微服务名."
else
for id in $ID
do
kill -9 $id
echo "killed $id"
done
fi
mv /data/applications/$NAME.log /data/applications/logs/$NAME.log-$logbk
nohup java -server -Xms2048m -Xmx2048m -Xmn512m -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=256m -Xverify:none -XX: DisableExplicitGC -Djava.awt.headless=true -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=$PORT,suspend=n -Duser.timezone=Asia/Shanghai -Denv=pro -javaagent:/usr/local/skywalking-agent/agent/skywalking-agent.jar -Dskywalking.agent.service_name=$1 -jar /data/applications/$NAME-$VERSION.jar > /data/applications/$NAME.log 2>&1 &