Skip to main content
Topic: Need to run a command after suspend, was a service in systemd. (Read 167 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Need to run a command after suspend, was a service in systemd.

So I installed Artix yesterday and did my usual stuff I do on an Arch install.

I installed init-headphone (https://github.com/Unrud/init-headphone & https://aur.archlinux.org/packages/init-headphone/)
from the AUR.

This package comes with a systemd service that looks as follows:
Code: [Select]
[Unit]
Description=Initialize headphone amplifier
After=suspend.target
After=hibernate.target
After=hybrid-sleep.target

[Service]
Type=oneshot
ExecStart=${sbindir}/init-headphone

[Install]
WantedBy=suspend.target
WantedBy=hibernate.target
WantedBy=hybrid-sleep.target
WantedBy=multi-user.target

It runs a command "init-headphone" after suspension, hibernate etc.

I don't know how to convert this to a OpenRC service, or how to get it working via another way.

I hope someone can help me out with this.

Thanks.


Re: Need to run a command after suspend, was a service in systemd.

Reply #2
AFAIK, both openrc and runit doesn't handle suspend/hibernate oneshot service (although in runit you can do it in a hacky way). logind (in our case, elogind) handles that. In /usr/lib/elogind/system-sleep directory, specifically.

For the details of the suspend hook, see  man 1 loginctl, the Hook Directories part.
the runit guy on artix