diff --git a/pilotgo_agent.sh b/pilotgo_agent.sh new file mode 100755 index 0000000000000000000000000000000000000000..43bc8f4c02d29b57f8cee8ca8da913a880f61fb7 --- /dev/null +++ b/pilotgo_agent.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +RED_COLOR='\E[1;31m' #红 +GREEN_COLOR='\E[1;32m' #绿 +YELOW_COLOR='\E[1;33m' #黄 +BLUE_COLOR='\E[1;34m' #蓝 +PINK='\E[1;35m' #粉红 +RES='\E[0m' + +mkdir log +echo -e "${GREEN_COLOR}****PilotGo客户端:开始执行自动化部署****${RES}\n\n" + +echo -e "${YELOW_COLOR}---step1:agent编译---${RES}" +go build -o agent pkg/app/agent/main.go +echo -e "${GREEN_COLOR}agent编译成功" +echo -e "${YELOW_COLOR}---step2:杀掉进程并且运行---${RES}" +i1=`ps -ef|grep -E "./agent"|grep -v grep|awk '{print $2}'` +echo -e "${BLUE_COLOR}杀掉运行进程$i1${RES}\n" +kill -9 $i1 + +echo -e "${YELOW_COLOR}---step2:agent运行---${RES}" +nohup ./agent >log/agent.log 2>&1 & \ No newline at end of file diff --git a/pilotgo_server.sh b/pilotgo_server.sh new file mode 100755 index 0000000000000000000000000000000000000000..3d5b172e516195d75255b017b457fb9ded1640fe --- /dev/null +++ b/pilotgo_server.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +RED_COLOR='\E[1;31m' #红 +GREEN_COLOR='\E[1;32m' #绿 +YELOW_COLOR='\E[1;33m' #黄 +BLUE_COLOR='\E[1;34m' #蓝 +PINK='\E[1;35m' #粉红 +RES='\E[0m' + +echo -e "${GREEN_COLOR}****PilotGo服务端:开始执行自动化部署****${RES}\n\n" +Cur_Dir=$(pwd) +mkdir log + +echo -e "${YELOW_COLOR}---step1:建立配置文件夹---${RES}" +cd /root +mkdir file_sd + +echo -e "${YELOW_COLOR}---step2:prometheus运行---${RES}" +nohup prometheus >$Cur_Dir/log/prometheus.log 2>&1 & +cd $Cur_Dir + +echo -e "${YELOW_COLOR}---step3:杀掉进程并且运行---${RES}" +i1=`ps -ef|grep -E "go run pkg/app/server/main.go"|grep -v grep|awk '{print $2}'` +echo -e "${BLUE_COLOR}杀掉运行进程$i1${RES}\n" +kill -9 $i1 +i2=`ps -ef|grep -E "/exe/main"|grep -v grep|awk '{print $2}'` +echo -e "${BLUE_COLOR}杀掉编译进程$i2${RES}\n" +kill -9 $i2 + +echo -e "${YELOW_COLOR}---step4:server编译运行---${RES}" +nohup go run pkg/app/server/main.go >log/server.log 2>&1 & +i3=`ps -ef|grep -E "go run pkg/app/server/main.go"|grep -v grep|awk '{print $2}'` +echo -e "${GREEN_COLOR}****server部署成功,部署的进程ID为:$i3${RES}****" +