From d9c66ad5ae3cdcb67271c7cefe1c000aa9ce315c Mon Sep 17 00:00:00 2001 From: "Yunkon (Alvin) Kim" Date: Mon, 9 May 2022 19:21:36 +0900 Subject: [PATCH] Update agent deployment scripts --- .../scripts/1.deploy-cb-network-agent.sh | 6 +++- .../scripts/2.re-deploy-cb-network-agent.sh | 32 ++++++++++++------- .../deploy-the-released-cb-network-agent.sh | 4 +++ .../redeploy-the-released-cb-network-agent.sh | 15 ++++++--- 4 files changed, 40 insertions(+), 17 deletions(-) diff --git a/poc-cb-net/scripts/1.deploy-cb-network-agent.sh b/poc-cb-net/scripts/1.deploy-cb-network-agent.sh index 677dfda..dd5cad0 100644 --- a/poc-cb-net/scripts/1.deploy-cb-network-agent.sh +++ b/poc-cb-net/scripts/1.deploy-cb-network-agent.sh @@ -29,7 +29,7 @@ cd ~/cb-network-agent # Get the execution file of the cb-network agent -wget -q --no-cache http://alvin-mini.iptime.org:18000/cb-larva/agent +wget -q --no-cache http://alvin-mini.iptime.org:18000/cb-larva/agent -O agent ls -al agent # Change mode @@ -121,6 +121,10 @@ cat <./stop-cb-network-agent.sh #!/bin/bash sudo pkill -15 -f cb-network-agent +sleep 1 + +sudo pkill -9 -f cb-network-agent +sleep 1 EOF diff --git a/poc-cb-net/scripts/2.re-deploy-cb-network-agent.sh b/poc-cb-net/scripts/2.re-deploy-cb-network-agent.sh index 27f1987..673b985 100644 --- a/poc-cb-net/scripts/2.re-deploy-cb-network-agent.sh +++ b/poc-cb-net/scripts/2.re-deploy-cb-network-agent.sh @@ -15,16 +15,16 @@ if [ "${ETCD_HOSTS}" == "no" ] || [ "${CLADNET_ID}" == "no" ]; then else echo "Step 1: Check status of the cb-network agent service" -sudo systemctl status cb-network-agent.service -sleep 1 +sudo systemctl status --no-pager cb-network-agent.service +sleep 2 echo "Step 2: Stop the cb-network agent service" sudo systemctl stop cb-network-agent.service -sleep 1 +sleep 2 echo "Step 3: Disable the cb-network agent service" sudo systemctl disable cb-network-agent.service -sleep 1 +sleep 2 if [ "${HOST_ID}" == "no" ]; then echo "No input host_id(${HOST_ID}). The hostname of node is used." @@ -40,7 +40,7 @@ cd ~/cb-network-agent # Get the execution file of the cb-network agent -wget -q --no-cache http://alvin-mini.iptime.org:18000/cb-larva/agent +wget -q --no-cache http://alvin-mini.iptime.org:18000/cb-larva/agent -O agent ls -al agent # Change mode @@ -131,7 +131,11 @@ sudo chmod 755 run-cb-network-agent.sh cat <./stop-cb-network-agent.sh #!/bin/bash +sudo pkill -15 -f cb-network-agent +sleep 1 + sudo pkill -9 -f cb-network-agent +sleep 1 EOF @@ -146,24 +150,25 @@ OS_ID=$(awk -F= '$1=="ID" { print $2 ;}' /etc/os-release | tr -d \") SYSTEMD_PATH="" case "$OS_ID" in - ubuntu*) + ubuntu*) echo "ubuntu" SYSTEMD_PATH="/lib/systemd/system/cb-network-agent.service" ;; - centos*) - echo "centos" + centos*) + echo "centos" SYSTEMD_PATH="/usr/lib/systemd/system/cb-network-agent.service" ;; *) - echo "unknown: $OS_ID" + echo "unknown: $OS_ID" ;; esac + # if systemd path is not "" if [ "${OS_ID}" == "ubuntu" ] || [ "${OS_ID}" == "centos" ]; then -cat <./stop-cb-network-agent.sh #!/bin/bash +sudo pkill -15 -f cb-network-agent +sleep 1 + sudo pkill -9 -f cb-network-agent +sleep 1 EOF diff --git a/poc-cb-net/scripts/redeploy-the-released-cb-network-agent.sh b/poc-cb-net/scripts/redeploy-the-released-cb-network-agent.sh index f64afef..fc85b94 100644 --- a/poc-cb-net/scripts/redeploy-the-released-cb-network-agent.sh +++ b/poc-cb-net/scripts/redeploy-the-released-cb-network-agent.sh @@ -12,7 +12,7 @@ if [ "${ETCD_HOSTS}" == "no" ] || [ "${CLADNET_ID}" == "no" ]; then else echo "Step 1: Check status of the cb-network agent service" -sudo systemctl status cb-network-agent.service +sudo systemctl status --no-pager cb-network-agent.service sleep 1 echo "Step 2: Stop the cb-network agent service" @@ -128,7 +128,11 @@ sudo chmod 755 run-cb-network-agent.sh cat <./stop-cb-network-agent.sh #!/bin/bash +sudo pkill -15 -f cb-network-agent +sleep 1 + sudo pkill -9 -f cb-network-agent +sleep 1 EOF @@ -160,7 +164,7 @@ esac # if systemd path is not "" if [ "${OS_ID}" == "ubuntu" ] || [ "${OS_ID}" == "centos" ]; then -cat <