Created
June 8, 2016 13:53
-
-
Save jellebens/5c3d80dbbf8eeebbb0ae908b8c9e9f42 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/sh | |
# Script to backup the SD card of a Pi to the nas. | |
backupLocation="/dev/athena/backup/openhabpi/" | |
backupName="$(date +%Y%m%d%H%S).img" | |
sudo dd if=/dev/mmcblk0 | sudo gzip > $backupLocation$backupName.gz | |
result=$? | |
if [ $result=0 ]; | |
then | |
ls -d -1tr $backupLocation*.img.gz | head -n -3 | xargs -d '\n' rm; | |
exit 0; | |
fi; | |
if [ $result=1 ]; then curl -F "AuthorizationToken=xxx" -F "Body=Backup of openhabpi failed" https://pushalot.com/api/sendmessage; exit 0; fi; | |
ls -d -1tr $backupLocation*.img.gz | head -n -3 | xargs -d '\n' echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment