I’ve been playing around with this and I think the easiest way by far is by using dom0’s cron. It always running and can wake up your VM for running the backups. Plus it doesn’t have problems with the crontab information being deleted upon reboot due to the lack of persistence of the root file system.
@JustAnotherQubesUser let me know if you have any issues.
For the sake of simplicity let’s say your AppVM called
work. To test if this is working, instead calling rsync, we’ll just create files with the current timestamp. It can later be changed to whatever you may want.
The basic idea is:
cron (dom0) -> backup.sh (dom0) -> backup.sh (
In order to be able to test things as we go, we’ll create them in reverse order
First you create a script on you
work AppVM, for example in
/home/user/scripts/backup.sh that contains:
# Any other thing could go here
# as this is the script that's executed periodically
touch $(date +%s) # create a file named with the timestamp
Note This script here could be avoided if on the second one we called directly the commands. But for separation of concerns and avoid anything else than it needs on dom0, were’re creating it.
Secondly we create a script that will call our first script. For example this can be on
<USER> is your dom0 username. It will contain
qvm-run work /home/user/scripts/backup.sh
Then, you open a dom0 terminal (XFCE Terminal) and setup a cron job (by running
crontab -e) and adding your cron line:
*/2 * * * * /home/user/backup.sh
The above will run it every two minutes. You’ll probably want to change it for whatever you want