Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
user:vvkjndl:openwrt-backup-with-exclusions [2020/10/13 14:08] – created vvkjndluser:vvkjndl:openwrt-backup-with-exclusions [2020/10/13 14:18] vvkjndl
Line 4: Line 4:
  
 :!: The only purpose of using this script is if you don't want specific files to be included in your backup archive file. :!: The only purpose of using this script is if you don't want specific files to be included in your backup archive file.
 +
 +  * Create two directories ''mkdir /root/backup; mkdir /root/scripts''.
 +  * Get all these three files to ''/root/scripts/''.
 +  * Make the script executable ''chmod +x /root/scripts/backup.sh''.
 +  * Run the script ''/root/scripts/backup.sh''.
 +  * Backup file will be available at /root/backup/ along with sha256 checksum file.
  
 <file txt backup-files-include> <file txt backup-files-include>
  
-This file will be generated by script automatically using ''sysupgrade --list-backup''.+This file will be generated by script automatically using "sysupgrade --list-backup" command.
  
 </file> </file>
  
 +<file txt backup-files-exclude>
 +
 +.keep*
 +.placeholder*
 +etc/opkg/keys/*
 +
 +</file>
 +
 +<file bash backup.sh>
 +
 +#!/bin/sh
 +
 +backdir=/root/backup/
 +backfile=backup-$(uci get system.@system[0].hostname)
 +backinclude=/root/scripts/backup-files-include
 +backexclude=/root/scripts/backup-files-exclude
 +
 +# tar backup with gzip and checksum generation
 +sysupgrade --list-backup > $backinclude
 +tar c -v -T $backinclude -X $backexclude -f - | gzip > $backdir/$backfile.tar.gz
 +echo "$(sha256sum $backdir/$backfile.tar.gz | cut -d ' ' -f1)  $backfile.tar.gz" > $backdir/$backfile.tar.gz.sha256sum
 +
 +</file>
  • Last modified: 2020/10/15 03:14
  • by vvkjndl