Pause backups for several hours and then resume?

Hey guys, so I’m planning on using duplicati to upload about 600GB files to cloud. The problem is we have a data cap with our ISP and can only upload these files in the mid night (12am to 7am). And I know with my upload speed, it would take about 2-3 days to upload these files.

So what I wanted to know is, is it possible with Duplicati to schedule the backup to start at 12am and run it till 7am and then pause it and re-start it automatically again in 12am until whole 600GB is uploaded?

Hi @Xander , welcome to the forum.

There is no built-in support for this scenario. You can manually pause/resume at the desired times.

In case you do not want to do it manually, you can perhaps do some scripting.
There is a pause/resume PoC tool:

This tool requires Python but can be invoked like:

python pause-resume.py pause
sleep 1000
python pause-resume.py resume

Then you can set up the triggers as relevant.

I asked ChatGPT to write a script, and it looks something like this (I have not tested it):

#!/bin/bash

# Function to calculate seconds until a specific hour
seconds_until_hour() {
    target_hour=$1
    current_epoch=$(date +%s)
    target_epoch=$(date -d "today ${target_hour}:00:00" +%s)
    if [ $current_epoch -gt $target_epoch ]; then
        # If the target time today has passed, calculate time until target hour tomorrow
        target_epoch=$(date -d "tomorrow ${target_hour}:00:00" +%s)
    fi
    echo $((target_epoch - current_epoch))
}

# Main script
while true; do
    # Calculate seconds until 12 am (00:00)
    sleep_seconds=$(seconds_until_hour 00)
    echo "Sleeping for $sleep_seconds seconds until 12 am"
    sleep $sleep_seconds
    echo "It is midnight, lets go!"
    python pause-resume.py resume

    # Calculate seconds until 7 am (07:00)
    sleep_seconds=$(seconds_until_hour 07)
    echo "Sleeping for $sleep_seconds seconds until 7 am"
    sleep $sleep_seconds
    echo "It is late, lets sleep"
    python pause-resume.py pause
done
1 Like

Hey @kenkendk, thank you for the welcome and reply. I also asked ChatGPT to give me a complete python code based on the github code you gave and it’s working. ChatGPT can really come in handy tho :smiley:

1 Like