dietpi-sync - run more often/continously? Topic is solved

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
hoverdonkey
Posts: 17
Joined: Sun Jul 12, 2020 2:32 pm

dietpi-sync - run more often/continously?

Post by hoverdonkey »

Hi

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.
User avatar
Joulinar
Posts: 4249
Joined: Sat Nov 16, 2019 12:49 am

Re: dietpi-sync - run more often/continously?

Post by Joulinar »

Hi,

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

Code: Select all

/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 :?

Why not storing your data on NFS directly?
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
hoverdonkey
Posts: 17
Joined: Sun Jul 12, 2020 2:32 pm

Re: dietpi-sync - run more often/continously?

Post by hoverdonkey »

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.
User avatar
Joulinar
Posts: 4249
Joined: Sat Nov 16, 2019 12:49 am

Re: dietpi-sync - run more often/continously?

Post by Joulinar »

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?
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
hoverdonkey
Posts: 17
Joined: Sun Jul 12, 2020 2:32 pm

Re: dietpi-sync - run more often/continously?

Post by hoverdonkey »

Joulinar wrote: Tue Mar 16, 2021 1:18 pm using /boot/dietpi/dietpi-sync 1 (with option 1) should execute the sync based on your pre-defind parameter
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.


Joulinar wrote: Tue Mar 16, 2021 1:18 pm Is there an option in Qbittorrent to execute a script once a download is complete?
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!
User avatar
Joulinar
Posts: 4249
Joined: Sat Nov 16, 2019 12:49 am

Re: dietpi-sync - run more often/continously?

Post by Joulinar »

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?
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
hoverdonkey
Posts: 17
Joined: Sun Jul 12, 2020 2:32 pm

Re: dietpi-sync - run more often/continously?

Post by hoverdonkey »

Joulinar wrote: Tue Mar 16, 2021 6:50 pm 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.
User avatar
Joulinar
Posts: 4249
Joined: Sat Nov 16, 2019 12:49 am

Re: dietpi-sync - run more often/continously?

Post by Joulinar »

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

Code: Select all

        #----------------------------------------------------------------
        # DietPi-Sync daily
        if [[ -f '/boot/dietpi/.dietpi-sync_settings' ]] && grep -q '^[[:blank:]]*SYNC_CRONDAILY=1' /boot/dietpi/.dietpi-sync_settings
        then
                /boot/dietpi/dietpi-sync 1
        fi
        #----------------------------------------------------------------
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
hoverdonkey
Posts: 17
Joined: Sun Jul 12, 2020 2:32 pm

Re: dietpi-sync - run more often/continously?

Post by hoverdonkey »

Joulinar wrote: Tue Mar 16, 2021 11:04 pm 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

Code: Select all

        #----------------------------------------------------------------
        # DietPi-Sync daily
        if [[ -f '/boot/dietpi/.dietpi-sync_settings' ]] && grep -q '^[[:blank:]]*SYNC_CRONDAILY=1' /boot/dietpi/.dietpi-sync_settings
        then
                /boot/dietpi/dietpi-sync 1
        fi
        #----------------------------------------------------------------
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 <Ok> or <Cancel>) or Cancel : Abort sync, no changes will be made (either <Ok> or <Cancel>).
Last edited by hoverdonkey on Tue Mar 16, 2021 11:24 pm, edited 1 time in total.
User avatar
Joulinar
Posts: 4249
Joined: Sat Nov 16, 2019 12:49 am

Re: dietpi-sync - run more often/continously?

Post by Joulinar »

yes I noticed the same. I will contact developer depending on my test this night
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply