Skip to content

Commit

Permalink
Merge pull request #301 from yunkon-kim/patch-yunkon-kim-1
Browse files Browse the repository at this point in the history
Update agent deployment scripts
  • Loading branch information
yunkon-kim authored May 9, 2022
2 parents 0701040 + d9c66ad commit 511deee
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 17 deletions.
6 changes: 5 additions & 1 deletion poc-cb-net/scripts/1.deploy-cb-network-agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -121,6 +121,10 @@ cat <<EOF >./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

Expand Down
32 changes: 20 additions & 12 deletions poc-cb-net/scripts/2.re-deploy-cb-network-agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand All @@ -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
Expand Down Expand Up @@ -131,7 +131,11 @@ sudo chmod 755 run-cb-network-agent.sh
cat <<EOF >./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

Expand All @@ -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 <<EOF | sudo tee -a ${SYSTEMD_PATH}
cat <<EOF | sudo tee ${SYSTEMD_PATH}
[Unit]
Description=Service of cb-network agent
Expand All @@ -178,11 +183,14 @@ Restart=on-failure
WantedBy=multi-user.target
EOF

echo "Step 9: Start the cb-network agent service"
echo "Step 9: Reload systemctl daemon"
sudo systemctl daemon-reload

echo "Step 10: Start the cb-network agent service"
sudo systemctl start cb-network-agent.service
sleep 1

echo "Step 10: enable start on boot of the cb-network agent service"
echo "Step 11: enable start on boot of the cb-network agent service"
sudo systemctl enable cb-network-agent.service
sleep 1
fi
Expand Down
4 changes: 4 additions & 0 deletions poc-cb-net/scripts/deploy-the-released-cb-network-agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ sudo chmod 755 run-cb-network-agent.sh
cat <<EOF >./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

Expand Down
15 changes: 11 additions & 4 deletions poc-cb-net/scripts/redeploy-the-released-cb-network-agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -128,7 +128,11 @@ sudo chmod 755 run-cb-network-agent.sh
cat <<EOF >./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

Expand Down Expand Up @@ -160,7 +164,7 @@ esac

# if systemd path is not ""
if [ "${OS_ID}" == "ubuntu" ] || [ "${OS_ID}" == "centos" ]; then
cat <<EOF | sudo tee -a ${SYSTEMD_PATH}
cat <<EOF | sudo tee ${SYSTEMD_PATH}
[Unit]
Description=Service of cb-network agent
Expand All @@ -175,11 +179,14 @@ Restart=on-failure
WantedBy=multi-user.target
EOF

echo "Step 9: Start the cb-network agent service"
echo "Step 9: Reload systemctl daemon"
sudo systemctl daemon-reload

echo "Step 10: Start the cb-network agent service"
sudo systemctl start cb-network-agent.service
sleep 1

echo "Step 10: enable start on boot of the cb-network agent service"
echo "Step 11: enable start on boot of the cb-network agent service"
sudo systemctl enable cb-network-agent.service
sleep 1
fi
Expand Down

0 comments on commit 511deee

Please sign in to comment.