From 90e01d05e0202e38902e21fa11850d52cd502f58 Mon Sep 17 00:00:00 2001 From: James Bunton Date: Mon, 14 Jun 2021 14:59:44 +1000 Subject: [PATCH 1/1] backup-openwrt --- hacks/backup-openwrt | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 hacks/backup-openwrt diff --git a/hacks/backup-openwrt b/hacks/backup-openwrt new file mode 100755 index 0000000..59b8640 --- /dev/null +++ b/hacks/backup-openwrt @@ -0,0 +1,11 @@ +#!/bin/bash + +BACKUP_HOSTS="$(awk '/^Host.*openwrt/ {print $2}' < ~/.ssh/config)" + +cd ~/backup-openwrt/ + +for host in $BACKUP_HOSTS; do + file="${host}.backup.tar.gz" + ssh "$host" sysupgrade -b - > "${file}.new" && mv "${file}.new" "${file}" +done + -- 2.39.2