Created
January 20, 2023 18:41
-
-
Save rodneyshupe/3419c50e0207acf2358d8aba03df7b25 to your computer and use it in GitHub Desktop.
Openwrt backup script
This file contains hidden or 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
#!/usr/bin/env sh | |
SD_MOUNT="$(echo "$(mount | grep '/dev/mmcblk.* on /mnt/mmcblk' | sed -e 's/\/dev\/mmcblk.* on \(\/mnt\/mmcblk.*\) type.*/\1/')")" | |
if [ -z $SD_MOUNT ]; then | |
echo "SD Card missing. Saving to /tmp" | |
BACKUP_PATH="/tmp" | |
else | |
BACKUP_PATH="${SD_MOUNT}/backup" | |
fi | |
# Generate backup | |
umask go= | |
sysupgrade -b $BACKUP_PATH/backup-${HOSTNAME}-$(date +%F).tar.gz | |
ls $BACKUP_PATH/backup-*.tar.gz | |
#From the client, download backup | |
#scp [email protected]:/tmp/backup-*.tar.gz . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment