-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate
30 lines (22 loc) · 776 Bytes
/
update
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash -e
if [ -d settings-backup ]; then
echo "ERROR: Backup directory exists. May be previous restoring was failed?"
echo "1. Save 'settings-backup' dir and 'settings.yaml' to safe location to make possibility to restore config later."
echo "2. Manually delete 'settings-backup' dir and try again."
exit 1
fi
echo "Stopping sensors2mqtt..."
sudo systemctl stop sensors2mqtt
echo "Creating backup of configuration..."
cp -R settings.yaml settings-backup.yaml
echo "Updating..."
git checkout HEAD
git pull
echo "Installing dependencies..."
sudo pip3 install -r requirements.txt
echo "Restore configuration..."
cp settings-backup.yaml settings.yaml
#rm -rf settings-backup
echo "Starting sensors2mqtt..."
sudo systemctl start sensors2mqtt
echo "Done!"