Backup from CLI

Hello. i am running OpenWRT and i would like to automate the backup procedure. Is there a way to keep a full backup of the system, from CLI, the same way is done from the WebUI?
The idea is to trigger it frequently and save in a NAS.

I'm using this in cron.

# packages backup
13 5 * * * /root/bin/opkgscript.sh write
14 5 * * * /bin/opkg list-installed | /usr/bin/cut -f 1 -d ' ' > /root/installed_packages.txt

# daily backup
15 5 * * * /sbin/sysupgrade -b /mnt/backup/backup-${HOSTNAME}-$(date +%F).tar.gz

/root is included in the folders to backup.
And the /mnt/backup is nfs mount to my NAS.

2 Likes

At the end, creating a backup is just copying the relevant files. You can just send (SCP, GIT, TAR, ...) the files to the NAS. Or use sysupgrade to create a file for you.

2 Likes