edit: I have since developed the script and added it to my SFOS repo
I use this simplistic script:
#!/bin/sh
user=defaultuser
backupdir="/home"
## Try to use mounted SDcard
outdir="$(grep -wo "/run/media/$user/[^ ]*" /etc/mtab)"
## elsewise just to ~/Downloads
[ -z "$outdir" ] && outdir="/home/$user/Downloads"
[ -w "$outdir" ] || { echo "Cannot write to $outdir"; exit 1; }
outfile="$outdir/backup-$(date '+%Y%m%d%H%M').tar.gz"
echo "Will make a full backup of $backupdir, stored in $outdir"
devel-su tar -v -c -z -f "$outfile" "$backupdir"
echo "Backup saved as $outfile"
3 of the 4 types of data are under /home; if you really want to include installed applications (and some settings like fingerprint data) you’re basically looking at a full system backup, so:
- replace
backup=/homewithbackupdir=/ - replace the grep for the mounted SDCard with some SSH magic so that the backup goes “over the air” (if that’s what you meant by that)
- add some excludes to the tar command (try
tar -h) - write a systemd timer to do this automatically at regular intervals; however, I cannot really recommend this if the backup is supposed to go out over the internet.