You are not logged in.
Pages: 1
I short, I'm looking for a way to cancel a pending request to put the system into sleep.
So, for example
1. systemctl suspend is called
2. I run a script in the sleep hook (as per the arch wiki)
3. depending on the outcome of the script in two, eighter allow the system to go to sleep, or cancels the sleep request
I've tried calling systemd-inhibit from a sleep hook, but I get the message
Failed to inhibit: The operation inhibition has been requested for is already runningwhich is pretty clear. So, it doesn't seem like inhibiting post-sleep request will work, so I'm wondering if there is any way to programmatically cancel a scheduled sleep request?
Offline
Consider the systemd-suspend.service:
[Unit]
Description=Suspend
Documentation=man:systemd-suspend.service(8)
DefaultDependencies=no
Requires=sleep.target
After=sleep.target
[Service]
Type=oneshot
ExecStart=/usr/lib/systemd/systemd-sleep suspendI wonder if it might be a good approach to write a replacement unit file, and override the ExecStart with your script?
Edit: I should mention that this just fell out of my head - I haven't actually tried it ![]()
Last edited by Ferdinand (2021-01-26 17:18:21)
Offline
I think a better solution may be to create a service that is required by the sleep target. Then a failure of that service should prevent the sleep.
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |
Offline
Pages: 1