I have a dozen openwrt edge endpoints and lost the configs to one during an upgrade..
so I came up with something..
change the username, password, and destination..
update cron, change perms, etc..
YMMV
#!/bin/sh
if ! [ -x "$(command -v sshpass)" ]; then
echo 'Error: sshpass is not installed.' >&2
opkg update
opkg install sshpass openssh-client
fi
export SSHPASS='sshpasswordhere'
umask go=
sysupgrade -b /tmp/backup-${HOSTNAME}-$(date +%F).tar.gz
sshpass -e scp -o "StrictHostKeyChecking no" /tmp/backup-${HOSTNAME}-$(date +%F).tar.gz useraccounthere@192.0.2.254:/exports/
rm /tmp/backup-${HOSTNAME}-$(date +%F).tar.gz
# service cron enable
# service cron start
# crontab -e
# 42 00 * * * /etc/sshbackup
# chmod 755 /etc/sshbackup
size of files fwiw..
16.0K /usr/bin/sshpass
184.0K /usr/libexec/scp-openssh