Skip to content

Instantly share code, notes, and snippets.

@fffx
Created July 4, 2021 04:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fffx/5e31f0147354af4484ffd72e4d6e92bc to your computer and use it in GitHub Desktop.
Save fffx/5e31f0147354af4484ffd72e4d6e92bc to your computer and use it in GitHub Desktop.
openwrt auto backup 自动备份
#!/usr/bin/env bash
## usage
# chmod +x ./backup.sh
# add it to your crontab
set -u
filepath=/tmp/${HOSTNAME}-$(date +%F)-backup.tar.gz
umask go=
/sbin/sysupgrade -b $filepath
scp $filepath ubuntu@my-server:/mnt/sda1/openwrt_backups
rm $filepath
echo "Done :)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment