Skip to main content
Topic: runit counterpart to systemd-inhibit? (Read 444 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

runit counterpart to systemd-inhibit?

I'm currently working on setting up a VM for Windows 10 with single GPU pass-through. Among the usual set of scripts needed for this to work is usually a systemd service containing the following to prevent the system from sleeping when libvirtd is active.

Code: [Select]
[Unit]
Description=Preventing sleep while libvirt domain "%i" is running

[Service]
Type=simple
ExecStart=/usr/bin/systemd-inhibit --what=sleep --why="Libvirt domain \"%i\" is running" --who=%U --mode=block sleep infinity

My question is, what would the runit equivalent for such a service be? Does runit have its own command to inhibit actions like Sleep with?

Re: runit counterpart to systemd-inhibit?

Reply #1
Runit stores running services in a file in /etc/runit/runsvdir/current, so having a shell script check if that file exists (with optionally safeties for the PID and the loop itself) should suffice.
A command for inhibiting sleep is however more difficult since the recommended way would be with kernel boot parameter, and you need something at runtime, so the next way is within /etc/elogind/logind.conf, you can make copies or edit directly with awk the lines related to sleep/idle/etc.