Gracefully Stopping Backups after certain time

Hi all,

I’ve fallen in love with Duplicati, but there is one aspect of it I am curious about as I set this up to replace multiple instances of CrashPlan.

Is there a way to gracefully stop a backup in progress? I would like to schedule a stop time for backups that run too long, especially as I re-upload a lot of data using Duplicati. I would have thought the CLI would have something there, but I didn’t see it in the help command. Ideally, it would be like pressing the “stop” button and letting it finish the chunk it is on so it can resume gracefully later.

Is this what you are looking for?

jmartin82, if the pause times in the tray icon context menu isn’t what you were thinking of, perhaps what you want is to use the pause icon in the web UI (I’m not sure if it works from the tray icon) at which point you’ll likely be prompted about WHEN to pause.

1 Like

Hi all, thanks for the replies.

The tray icon context menu pause isn’t what I’m looking for, because it’s just a manual on/off.

The pause icon in the web UI doesn’t prompt me for when to pause it, but for how long to pause it. This is also a manual process.

I would like to just throw Duplicati a “stop after upload” command that I could schedule. I could schedule backup windows very easily in CrashPlan, and I’m trying to recreate that in Duplicati, essentially.

Odd - I know I’ve gotten the “pause now or after the next upload” prompt somewhere… If I can find it I’ll let you know.

That option is there when you hit the X to stop a backup in the web GUI. A great option for manually doing it, but I’d like to be able to schedule that command.

Thanks jmartin82, that’s where I remember seeing it - in the X (abort) process!

Not exactly what you want, but you can try Sysinternals’ PsSuspend as a workaround, as suggested by @clarityoffline here:

This sounds more like a feature request for having a set maximum time a backup can run. I have moved it to #features.

1 Like

Thanks again for the responses. I’ll try out the PsSuspend option and other ways I can do this. I didn’t realize this is a feature that would be missing, but I’ll live considering how great Duplicati is everywhere else.

Thanks @kees-z

I hope I’m not hijacking this thread. This is also a requirement for my use (as a person who has also come from Crashplan). So I’ve been looking into this and I have some questions that I’m hoping someone could comment on.

So one option is to use something like pssuspend. I’m not sure I see the advantage in this over pressing the pause button in duplicati? However, if there is a difference, pssuspend is great if you expect to resume before the computer reboots. However, if you don’t resume before the computer is next rebooted it will be the same as if you had shutdown your computer while duplicati was busy doing a backup. What is the implication of this? Would duplicati just start the backup from scratch when your computer restarts or will it realise it was in the middle of a backup and just continue with the files that it hadn’t finished backing up plus any new files that have been created/modified since then? Is it bad to reboot a computer while duplicati is in the middle of backing up or will it be happy? Also, if you are backing up to an external USB drive, will it close the connection to the drive at this point to allow it to be ejected safely?

Another option would be to press the pause button in the trayicon. If you reboot your computer before resuming it looks like it just starts again on the backup, which I guess is ok since in theory it won’t backup the things it has already done. I’m not yet sure if it would allow you to eject an external USB drive at this point, I have more testing to do.

Another option would be to press the X abort button in the GUI. This is my least favoured option as it involves the user having to open up the web gui just to stop the backup, so if pause works I think that is the one I’d be getting users to do if they are wanting to eject their USB harddrive.

If anyone has any insights to how duplicati behaves under these conditions and if any way is better I welcome thoughts.

Duplicati keeps track of what has completed and what has not. Termination is safe, as the database is transaction based and can tolerate this. On the next run, Duplicati will evaluate what completed and what did not.

If you pause for long periods, the transfers will likely fail due to network timeouts. But as Duplicati will retry five times before giving up (default setting), this will likely not be a problem.

But there is no particular support for unmount. There is, however, a strict consistency check on each run, which should detect partially written files on the external disk.

2 Likes

Thanks very much @kenkendk. That is great to know.

I was opening a new topic, while I saw this discussion in the panel of similar topics.

Today I realized that a backup job got stuck since August 22 and this prevents other jobs from running (that is a devastating thing). Usually I read the log file that the jobs send to my email, but this time I forgot to do it. Anyway it is not the first time it happens.

I don’t know if my situation is the same of the original poster: it seems to me that he want to stop the job because it is tired to wait for its completion, while I want to stop it because I’m sure that something has gone wrong (and it happens not seldom with cloud destinations) so it will never finish correctly.

(My original question was: So I ask: is there any way to automatically abort a backup job (to the cloud) that get stuck? Something similar to: if there is no data transmitted in the last 120 minutes, than stop considering the job failed.)

Just to chime-in, if we’re making this a regular feature request, I do think it would be a fantastic idea to be able to put a time limit on backups. It would be close enough to the backup window that Crashplan allows users to set.

Yes, I second the request to add this feature.

Any way to consider adding ths feature?
Sometimes it still happens that Duplicati hangs on and I have to kill it and restart it manually (if I dont’ forgot).

Doubtful, due to lack of skilled volunteers, but there’s always the chance somebody will decide to try.

There’s also a question of which feature. This took a sharp turn away from the original one right here:

These are likely different code. OP is functioning code doing controlled things. Second is total mystery, possibly requiring a process kill and restart. As there may be only one process, what does that restart?

Original feature possibly could be handled similarly to how the Stop button does controlled backup end.

New feature may be harder or easier. I don’t know. There could maybe be a very-likely-to-be-up thread keeping track of the progress of other things to kill everything (including itself) if things seem very stuck. Question of what does the restart remains. Ideally, I think a separate monitor/killer/restarter is required.

https://github.com/duplicati/duplicati/blob/master/Duplicati/Service/Runner.cs
looks like it uses the documented ping-pong-keepalive as part of its rudimentary monitor/killer/restarter, however that’s already a separate process restarting another, and this isn’t always so for a non-service because a single process server is possible. By default now (until update method changes, and it may) there is a parent process that checks for newest installed update. It starts second process of latest one.

https://github.com/duplicati/duplicati/blob/master/Duplicati/Library/AutoUpdater/UpdaterManager.cs

and the thing to look at is the child exit code, and whether or not it is MAGIC_EXIT_CODE for a restart.
This is used to restart after an autoupdate, but isn’t reliable so if someone looks, maybe it can be fixed.

There are my two ideas for a developer volunteer to look at, but for now I think you should troubleshoot:

and to avoid forgetting, consider using the Reporting options and maybe Duplicati Monitoring to detect.
Please do this in a separate topic. This one is a feature request for a specific feature or maybe several.

“Sometimes it still happens that Duplicati hangs on and I have to kill it and restart it manually (if I dont’ forgot).”

That’s actually a “bug” so-to-speak or fault of Duplicati’s programming. The stop/cancel function has no way to work past a certain issue with how Duplicati is coded. Duplicati thus can get stuck requiring a force end of Duplicati.

To actually keep it short for once, I’m ending it there lol. Its actually complicated and requires a lot more words. But, that’s the easy way to say it that a non-programmer might understand or misunderstand.