I use rclone to backup my LXD containers to an encrypted google drive.
I use monit to check backups succeeded by checking the mtime on touched files as rclone unfortunately doesn't properly handle mtime on directories yet. Need to rm the files first as touching existing files to change their mtime doesn't work with rclone mounted volumes.
Hope this is helpful to someone!
LXD: https://linuxcontainers.org/lxd/introduction/
Monit: https://mmonit.com/monit/
lxdbackup script: https://github.com/cloudrkt/lxdbackup
Shell script in cron:
#!/bin/sh
BKUPDIR="/media/encvol/Backups/Containers"
BKUPSCRIPT="/root/scripts/lxdbackup.sh"
LXC="/snap/bin/lxc"
## Check for encvol mount
if findmnt --raw --noheadings encvol: /media/encvol ; then
echo "encvol is mounted!\n\n"
for contner in $($LXC list -c n --format csv); do
echo "Backing up $contner container to $BKUPDIR/$contner ...\n"
if $BKUPSCRIPT $contner ; then
rm $BKUPDIR/$contner/backup_time && touch $BKUPDIR/$contner/backup_time
else
echo "$contner backup failed!"
fi
echo "\n\n"
done
## If encvol not mounted, error message
else
echo "encvol not mounted!\n"
exit 1
fi