Skip to content

Commit

Permalink
Adding update script (Koenkk#525)
Browse files Browse the repository at this point in the history
* Adding update script

Fix Koenkk#389

* Update update.sh :)

* Make executable & update update.sh
  • Loading branch information
jwillmer authored and Koenkk committed Oct 22, 2018
1 parent 97cc56b commit e54de4b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,5 @@ data/database.db
data/config.json
data/log*.txt
data/state.json
data/log
data/log
data-backup/
24 changes: 24 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash -e

echo "Stopping zigbee2mqtt..."
sudo systemctl stop zigbee2mqtt

echo "Creating backup of configuration..."
cp -R data data-backup

echo "Updating..."
git checkout HEAD -- npm-shrinkwrap.json
git pull

echo "Installing dependencies..."
rm -rf node_modules
npm install

echo "Restore configuration..."
cp -R data-backup/* data
rm -rf data-backup

echo "Starting zigbee2mqtt..."
sudo systemctl start zigbee2mqtt

echo "Done!"

0 comments on commit e54de4b

Please sign in to comment.