dietpi-sync - run more often/continously?


I want to automatically copy new downloads from the DietPi system drive to my NAS (for which I already have an NFS mount set up in DietPi).

diet-pi sync works but, so far as I can tell, can only do it on a manual or daily basis. Can I change its frequency (e.g. to every five minutes, or even continuous monitoring)? Else is there another software for DietPi that would do this?

Forgive if this a noob question, but I looked and could not find an answer. Many thanks.


once you configured dietpi-sync, you could try to put the sync scipt into crontab and to have it executed every x minutes.

/boot/dietpi/dietpi-sync 1

But I’m not sure what will happen if you start a new sync, while to old one is still running :thinking:

Why not storing your data on NFS directly?

Thanks for your reply, appreciated. I’ll look see if I can find the dietpi-sync script and crontab folder and try it. I did already see the cron settings in DietPi but did not know if/how they could be applied to the sync function. I’ll have a go.

My main reason for doing this is to reduce spin time on the NFS (NAS) disk - I thought that since the DietPi system is awake anyway it might as well handle the (slow) downloads and do a (quick) copy across when done. Benefits include reduced wear on NAS drives, less energy usage overall. Also, the NAS is a bit noisy and is in a spare bedroom which is sometimes used, so it’s best if it doesn’t wake up in the middle of the night.

Another benefit is that torrent downloads could be left seeding in the DietPi system whilst I use the copy wherever I need it. Qbittorrent can be set to download in to place (e.g. DietPi system disk) and, on completion, move (but not copy) the download to another place (e.g. NFS mount on NAS). This achieves most of what I want apart from seeding, but I like getting three gold stars!

Many thanks.

using /boot/dietpi/dietpi-sync 1 (with option 1) should execute the sync based on your pre-defind parameter

Is there an option in Qbittorrent to execute a script once a download is complete?

I have had a go but not sure what I’m doing. I tried creating a new file in the cron.minutely folder with /boot/dietpi/dietpi-sync 1 in it and set period for 5 mins in Dietpi-cron. Suffice to say, it did not work.

There is, but I do not now how to use it. I tried pasting in /boot/dietpi/dietpi-sync 1 into the box, did a new quick download to try to trigger it, but nothing happened.

As you can tell I really do not know what I am doing, so it’s probably best if I back off!

What is the name of the script you have been created? And is /boot/dietpi/dietpi-sync 1 working if you go to execute it manually?

The script is /boot/dietpi/dietpi-sync

I just tried /boot/dietpi/dietpi-sync 1 manually. It launched dietpi-sync to the option to “Sync: Continue with real sync” (or, Log or Cancel) i.e. it did not proceed with the sync, without me pressing enter.

hmm let me check it over night on a test system. At least it is exactly the same command that will be used on the daily job

        # DietPi-Sync daily
        if [[ -f '/boot/dietpi/.dietpi-sync_settings' ]] && grep -q '^[[:blank:]]*SYNC_CRONDAILY=1' /boot/dietpi/.dietpi-sync_settings
                /boot/dietpi/dietpi-sync 1

i have just noticed that if I select the cancel option (as mentioned in my last post) it immediately does the sync.

EDIT: to clarify - the sync will proceed on pressing Enter for all permutations of of Sync: Continue with sync (either or ) or Cancel : Abort sync, no changes will be made (either or ).

yes I noticed the same. I will contact developer depending on my test this night

I just added an edit to previous post:

EDIT: to clarify - the sync will proceed on pressing Enter for all permutations of of Sync: Continue with sync (either or ) or Cancel : Abort sync, no changes will be made (either or ).

I know

I still do not know if I have done this correctly so have not been able to check if this would work (i.e. to check it would bypass the blocking behaviour we just found).

Was I correct in creating a file with the single line /boot/dietpi/dietpi-sync 1 in it, in directory /etc/cron.minutely. Or was I supposed to do something with crontab -e (which I would have no idea what to do with!)?

I really appreciate your support and guidance so far, thank you.

Was I correct in creating a file with the single line /boot/dietpi/dietpi-sync 1 in it, in directory /etc/cron.minutely.

what is the name of the file you created?
And did you assigned execute permission?
As well did you activate cron.minutely by running dietpi-cron

I called the file qbitsync.
I hadn’t assigned execute, but I have now.
Yes, I did activate that.

I’ve got it working! I copied the file /etc/cron.daily/dietpi into /etc/cron.minutely, renamed it (to avoid confusion) and made it executable. The minutely sync now works. Apologies if this is what you meant in your first post of the thread.

Only problem is that (only now do) I see that it doesn’t quite do what I want! When I remove files from the destination folder (i.e. move them to where I want them) they reappear with the next sync, which is to be expected (ain’t hindsight wonderful!) Now, if only I could tell it only to to sync stuff that is less than a minute old!

Just to report in that I’m getting closer to my goal.

I started looking at the Qbittorrent “Run external programme on completion” box as suggested in an early post. Putting cp -r “%F” “/mnt/NFS_path” in the box successfully copies the just completed files with their path to where i want them. However, the copied files have permissions that stop them being moved/deleted in my Windows File Explorer. Back in dietpi terminal, running the command chmod 777 -R “/mnt/NASSY_NFS_Video/aqBittorrentdone” fixes this. However, I do not know how to combine the two commands so they can both run automatically. I have read that a script is required but so far my attempts have failed. I’ll keep grinding away…

what user/permissions the files have once moved by Qbittorrent external command?

Group: dietpi [1000]
Owner: qbittorrent [999]

The main folder is drwxrwxr-x
The files within are -rw-rw-r–

in meantime I got dietpi-sync running from qbit external command but it will end up same user permissions as they are download by qbit

-rw-rw-r-- 1 qbittorrent dietpi

question is if write permission for other would be enough to be able to access files on the NAS. Means to use 666 instead of 777

There is an old request on qbit github to add a feature to be able to change permission :slight_smile: