resticprofile icon indicating copy to clipboard operation
resticprofile copied to clipboard

run-before background job

Open bdillahu opened this issue 2 years ago • 2 comments

Maybe I'm approaching this the wrong way, but I have a client machine running a backup that tends to go to sleep too soon... It's a Mac which has a "caffeinate" command available that will keep it awake.

There are a couple of options to run it... either run it in a separate task or have it call the job it's waiting on.

There doesn't seem to be a way to "wrap" a resticprofile backup command with a "caffeinate" command, so I figured I would just run "caffeinate &" as a run-before - except it doesn't seem to actually background the job, it waits for it to finish (never).

I would then clean up with a "killall caffeinate" which is the documented method.

ls there a way to have a run-before job background?

bdillahu avatar Aug 02 '22 17:08 bdillahu

Hi,

As opposed to run something in the background, we could instead allow wrapping the restic command in another one. Typically resticprofile could call caffeinate -i restic ... instead of restic directly. That would work, and should just be a small addition to the config

creativeprojects avatar Aug 02 '22 20:08 creativeprojects

Works for me... trying to come up with the most "versatile" way of doing it, since I'm sure somebody else will try to do something different :-)

bdillahu avatar Aug 02 '22 21:08 bdillahu

As it is a very specific use case, I think I'm going to introduce a new global prevent-sleep flag.

It will be using caffeinate on macOS, some kernel32 API on Windows and I need to look if there's a way to do that on Linux (not sure yet, all my Linux machines are always-on so I never had the problem)

creativeprojects avatar Aug 29 '22 19:08 creativeprojects

I like that… looks like systemd supports some options:

https://askubuntu.com/questions/577862/how-to-temporarily-disable-sleep-and-hibernate-from-the-command-line

bdillahu avatar Aug 29 '22 19:08 bdillahu