You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mac falls asleep during backup, resulting in low level errors.
It would be great to have a recommended way to prevent this. Ideally a setting in Vorta.
I have also considered whether this could be achieved by putting caffeinate in the shell commands to run before backup, but from my understanding this would not work, since caffeinate never terminates, it just keeps the Mac from sleeping while it runs.
Of course sleep can be prevented altogether which fixes the problem but is not very environment friendly.
There is a caffeine python module: https://pypi.org/project/caffeine/
And can use systemd-inhibit for Linux: https://github.com/systemd/python-systemd. Most Linux distros use systemd so we should be fine with just that.
Just have to put it at the start of init and the end of finished_event in borg_thread
Yes, but would it be ok to simply make this the default behaviour (that sleep is not allowed while the borg command runs)? For me personally this would be perfectly fine. If no configuration is required, this appears to be relatively easy to implement.
I have in the meantime also explored if the problem can be solved by using pmset as pre-backup and post-backup shell commands to disable sleep and then reenable. However, the problem with that is that it would have to be run as root.
My preliminary fix now is to run "caffeinate&" as pre-borg shell command, and "killall caffeinate" as post-borg shell command. A bit dirty, since it messes with other caffeinate commands in case there are any. But seems to work. The built-in solution discussed above would still be better, of course.
the code itself traces its origin back to another repository, which also indicates it should be considered MIT licensed - https://github.com/pudquick/pypmset
so I think you would be in the clear to copy this code.
Activity
samuel-w commentedon Sep 18, 2020
There is a caffeine python module: https://pypi.org/project/caffeine/
And can use systemd-inhibit for Linux: https://github.com/systemd/python-systemd. Most Linux distros use systemd so we should be fine with just that.
Just have to put it at the start of init and the end of finished_event in borg_thread
stefanbuehler commentedon Sep 19, 2020
Yes, but would it be ok to simply make this the default behaviour (that sleep is not allowed while the borg command runs)? For me personally this would be perfectly fine. If no configuration is required, this appears to be relatively easy to implement.
m3nu commentedon Sep 19, 2020
This would need a OS-independent base class and then OS-specific implementations again.
We also can't add the
caffeinepackage as dependency, since it's too old and unmaintained. But reusing the code may be possible if the copyright can be clarified. https://github.com/jpn--/caffeine/blob/master/caffeine.pystefanbuehler commentedon Sep 19, 2020
I have in the meantime also explored if the problem can be solved by using pmset as pre-backup and post-backup shell commands to disable sleep and then reenable. However, the problem with that is that it would have to be run as root.
samuel-w commentedon Sep 19, 2020
It's MIT licensed https://github.com/jpn--/caffeine/blob/master/LICENSE.txt, which is GPL3 compatable
stefanbuehler commentedon Oct 21, 2020
My preliminary fix now is to run "caffeinate&" as pre-borg shell command, and "killall caffeinate" as post-borg shell command. A bit dirty, since it messes with other caffeinate commands in case there are any. But seems to work. The built-in solution discussed above would still be better, of course.
unilynx commentedon Jan 15, 2021
https://github.com/jpn--/caffeine/blob/master/LICENSE.txt shows a MIT license, and the name in the license file matches the author of the repository
the code itself traces its origin back to another repository, which also indicates it should be considered MIT licensed - https://github.com/pudquick/pypmset
so I think you would be in the clear to copy this code.