How to combine Backup and Sync in one cron script

Hi fellas,

I was wondering if it was possible to combine a backup with a sync.

I would like to do both one after the other via a script (unattended) launched daily or weekly.

I am aware there are plans to merge dietpi-backup and -sync but as this isnt there yet, I am looking for other ways to backup my dietpi and sync the result from one HDD to another.

I am also aware of the option to enable daily sync within the options of the dietpi-sync but I am afraid that this will collide as cron jobs are triggered in parallel. So the backup via a script within cron.daily (Taken from another forum post) might run at the same time as sync which might lead to incorrect results.

I guess my question is can I combine dietpi-backup and dietpi-sync in one script I put into cron.daily?
I tried but the logfile I try to write to doesnt update which makes me think I am overseeing something and the commands cannot bei combined easily.

Thanks in advance!

You could add both command calls to the same crontab/script, like:

/DietPi/dietpi/dietpi-backup 1 || exit 1
/DietPi/dietpi/dietpi-sync 1 || exit 1
exit 0

So the correct order and no concurrency is guaranteed.
Daily sync of course needs to be disabled then for dietpi-sync.


I will give this a try a report back.

Thank you very much in advance.

Test was successful.

Works like a charme. :slight_smile: