-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #527 from village-way/main
fix: node-agent restart when the version not changed #526
- Loading branch information
Showing
3 changed files
with
20 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
sed -i 's/^WEB_USER=.*/WEB_USER=$(WEB_USER)/' /app/agent.env | ||
sed -i 's/^WEB_PASS=.*/WEB_PASS=$(WEB_PASS)/' /app/agent.env | ||
sha256sum /app/node-agent > node-agent.sum | ||
sha256sum /host-path/node-agent >> node-agent.sum | ||
rsync -avz /app/ /host-path/ | ||
cp /app/node-agent.service /host-systemd/node-agent.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
#!/usr/bin/env bash | ||
sudo systemctl daemon-reload | ||
sudo systemctl enable node-agent | ||
sudo systemctl stop node-agent | ||
sudo systemctl start node-agent | ||
img_app_sum=$(head -n 1 /srv/node-agent/node-agent.sum | cut -d' ' -f1) | ||
host_app_sum=$(sed -n '2p' /srv/node-agent/node-agent.sum | cut -d' ' -f1) | ||
if [ "$img_app_sum" == "$host_app_sum" ]; then | ||
echo "app is same, skip restart node-agent" | ||
else | ||
echo "app is different, restart node-agent" | ||
sudo systemctl daemon-reload | ||
sudo systemctl enable node-agent | ||
sudo systemctl stop node-agent | ||
sudo systemctl start node-agent | ||
fi |