Created
October 5, 2021 10:33
-
-
Save crabdancing/4c505d8f1ad6fe1dcd6fd16612af2b25 to your computer and use it in GitHub Desktop.
Automatically backup your OpenWRT router configuration to a local tarball under ~/Backups
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 bash | |
# script based on instructions from: | |
# https://openwrt.org/docs/guide-user/troubleshooting/backup_restore | |
router_hostname=mainrouter.lan | |
# Generate/update backup | |
ssh "$router_hostname" 'umask go=; sysupgrade -b /tmp/backup-${HOSTNAME}-$(date +%F).tar.gz' | |
# Download backup | |
mkdir -p ~/Backups/"$router_hostname" | |
scp root@"$router_hostname":/tmp/backup-*.tar.gz ~/Backups/"$router_hostname" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@jstrot
Yes, that's definitely much better. Good catch!