Simple Schnapps Backup Script

Hi,
In case anyone finds it useful please see the below script that creates a snapshot, then creates a tar file and finally copies this to a specified location such as a cifs mounted share.

I actually locate this script on a mounted cifs share and create a Custom Command within the LuCI interface for quick access. You can also schedule it to perform regular backups.

Edit line 6 ( cd /enter/your/path/here/ )

#!/bin/sh
current=`date '+%d_%m_%Y--%H_%M_%S'`
schnapps create "Snapshot_$current"
sshot="$(schnapps list | grep single | awk '{print $1}' | tail -n1)"
schnapps mount $sshot
cd /enter/your/path/here/
tar -c -f snapshot-"$sshot"_"$current".tar /mnt/snapshot-@$sshot
umount -v /mnt/snapshot-@$sshot
rm -rf /mnt/snapshot-@$sshot

I have not tested the restore process so please do not hold me responsible if it all goes bad but the procedure would be something along the lines of the below.

Untar the backup file to a temporary location and copy to / over writing existing contents, finally reboot:

mkdir </tmp/path>
cd </tmp/path>
tar -x -f </path/to/snapshot_file>.tar
cd </tmp/path/mnt/snapshot-@<number>>
cp -a -f * /
rm -rf </tmp/path>
reboot
2 Likes

Editing Error

Editing Error

Editing Error

Yes, you can edit it yourself. Try it again. It should work. For me it works many times.
Just click on icon “Pencil”

Editing Error

Editing Error

Which browser do you use? For example: In Chrome it works w/o any issues.

Editing Error

Editing Error

Editing Error

Editing Error