autobackup

autobackup


generate rsa key for dropbear

dropbearkey -t rsa -f /root/.ssh/id_dropbear

get pub key

dropbearkey -y -f /root/.ssh/id_dropbear

/backup.sh

#!/bin/bash

/sbin/sysupgrade -b /tmp/backup-${HOSTNAME}-$(date +%F).tar.gz
/usr/bin/scp -i /root/.ssh/id_dropbear /tmp/backup*.tar.gz USERNAME@HOSTNAME:/path/to/backups/
/bin/rm -f /tmp/backup*.tar.gz

/etc/sysupgrade.conf

/backup.sh

/etc/crontabs/root

0 0 * * *       /bin/bash /backup.sh

# for debug u can use
0 0 * * * /bin/bash /backup.sh 2>> /tmp/backup.log

Содержание