-
-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to get snapshots issue after leaving Sleep mode on Windows #180
Comments
Hmm, one way you may be able to work around this (it's a bit silly) is with a command hook that runs a sleep statement to delay running the backup operation until your NAS has time to mount. You could even use a while loop of some sort to continually poll and finally exit the script when the volume is available. The biggest caveat I'll add is that command hooks are entirely untested on windows and they default to |
Command hook implementation is here https://github.com/garethgeorge/backrest/blob/main/internal/hook/commandhook.go#L13-L39 so you can get some idea of how to craft a script that should work w/windows. If just setting #! cmd.exe does work, I'll try to make a fix to set that as the default for the windows build. |
Thanks, that's a great idea! The first few steps of this worked after some trial and error. I used Then I tried to use the So instead I got rid of the Finally, I tried an alternate way of pausing the command line and although it's a bit hacky, Execution paused for 30 seconds and after that I see the backup start. Haven't yet tested if it solves my issue after waking up my computer, so I'll leave it like this for a few days and get back to you if I see the snapshots going through. Appreciate the help! |
Hmm, on Linux/MacOS /bin/sh and /bin/bash can accept a script written to their stdin. I'm not seeing an obvious way to do this on Windows. I think the best workaround would be to create a new
may work. I may aim to add a "script" hook type that accepts a filepath instead of the script as text so that I can support this in a crossplatform way. |
Actually, I think it works just fine here because ultimately the ping solution worked as I mentioned above. There may just be issues with the
This would still be a useful option though! In addition to the automatic cmd detection on Windows you mentioned earlier^ As for my testing with this ping hack, it works so far! When I check the logs after waking up my computer I see the backup went through after 30 seconds and succeeded: So this looks promising but one thing I have yet to check is if it'll work after waking up my computer and not logging in immediately, just to be sure the issue is the NAS mounting and not something else. Will report back when I've tried that, thanks! |
Brilliant, glad this patch worked. I'll leave this open to track defaulting to cmd.exe for script execution on Windows. |
Sounds good, and to give one last update here I did a test leaving my PC logged out but still on and the backup worked correctly though after a longer delay than expected. So it does seem to be that the NAS mounting was the culprit, therefore this solution should hold up in all situations where it mounts in under 30 seconds :) I do still think it would be nice to have a "wait X amount of seconds before catching up on backups" option for the user in the UI (so that I don't have to hook up these hacky scripts in the first place) but I understand that this is an uncommon case. If it was up to me though I'd want the most control possible over how/when it runs considering all the different situations & platforms Backrest could be run from. Even if this option had to be enabled via a settings file or hidden under an "advanced options" dropdown to keep the main experience simple I'd still think it's worth it, but that's just me haha Regardless though, thanks a ton for the help and I'm really glad I got this figured out :D |
Describe the bug
I have a scheduled plan that is supposed to run at 5pm each day with the target repo existing on an external NAS machine plugged into my computer. Everything seems to work fine for the most part when the computer is active but I've noticed some backups failed to go off if my computer is asleep during the scheduled time. Of course I wouldn't expect it to run in this state but I saw that it actually attempts a backup after I log in and fails, giving the error
failed to get snapshots for plan
with exit status 1. Because of this I haven't been getting my files saved every time this happens and I have to backup manually using the "Backup Now" button while my computer is awake to get new snapshots.To Reproduce
Steps to reproduce the behavior:
Expected behavior
Hoping that the backup can succeed once I leave sleep mode and log in.
While I don't know what "failed to get snapshots" exactly means in restic/backrest terms (perhaps it can't connect to the repo location?), my ideas as to why this is happening are:
Some potential approaches for fixing this:
Screenshots
Would appreciate any info regarding what exactly this error means as it would help track down the best route to fix it.
Desktop (please complete the following information):
Thanks for any help regarding this issue! I really love the way this app works and would be happy to see this streamlined in some way so I can better trust that my files are being backed up without having to manually check it so often.
The text was updated successfully, but these errors were encountered: