Skip to content

Commit

Permalink
Agent upgrade script update
Browse files Browse the repository at this point in the history
  • Loading branch information
NehaNaithani committed Feb 25, 2021
1 parent 1c91a6e commit 88a5d8b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packaging/iofog-agent/usr/share/iofog-agent/upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@ get_distribution() {
BACKUP="/var/backups/iofog-agent/config.xml"
cp "$ORIGINAL" "$BACKUP"

# Stop agent
service iofog-agent stop

# Create backup for rollback
cd /var/backups/iofog-agent
tar -cvzf config_backup$iofogpackage.tar.gz -P /etc/iofog-agent
tar -cvzf log_backup_upgrade$iofogversion.tar.gz -P /var/log/iofog-agent
printf 'ver: %s %s' $iofogversion $iofogpackage > prev_version_data

# Stop agent
service iofog-agent stop
# remove current configs
rm /etc/iofog-agent/*

# Perform upgrade
Expand All @@ -51,6 +53,11 @@ get_distribution() {
esac

# Restore config and start agent
cd /var/backups/iofog-agent
tar -xzf config_backup$iofogpackage.tar.gz
mv etc/iofog-agent/* /etc/iofog-agent/
echo 'config restored'

cp "$BACKUP" "$ORIGINAL"
starttimestamp=$(date +%s)
service iofog-agent start
Expand Down

0 comments on commit 88a5d8b

Please sign in to comment.