Created
October 21, 2022 22:06
-
-
Save opsnlops/80d27e43447acbdc0b57500cf0707e3a to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
TIMESTAMP=$(date +"%Y%m%d") | |
FS_FILENAME=ha-file-system-backup-$TIMESTAMP.tar.gz | |
SQL_FILENAME=ha-database-backup-$TIMESTAMP.sql.gz | |
# Removed influxdb since it's getting huge and I don't really | |
# think I have much benefit in backng it up | |
cd /local | |
echo "Tarring up file system..." | |
sudo tar -cvzf backups/$FS_FILENAME ha/ zwavejs/ node-red/ z2m/ /home | |
echo -e "\n\nDumping database to backups/$SQL_FILENAME..." | |
sudo -u postgres pg_dumpall | gzip --best > backups/$SQL_FILENAME | |
ls -la backups/$SQL_FILENAME | |
echo -e "\n\nCopying to B2..." | |
b2 upload-file home-automation-backups backups/$FS_FILENAME $FS_FILENAME | |
b2 upload-file home-automation-backups backups/$SQL_FILENAME $SQL_FILENAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment