Difference between revisions of "Talk:Laptop"
m (→RUN+="" won't work reliably: oops...) |
m (→System76: remove closed discussion) |
||
(9 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== RUN+="<command>" won't work reliably == | == RUN+="<command>" won't work reliably == | ||
Line 36: | Line 23: | ||
:The {{ic|1=ENV{SYSTEMD_WANTS}="suspend.target"}} should be used ideally, but it has to be combined with {{ic|1=TAG+="systemd"}}. | :The {{ic|1=ENV{SYSTEMD_WANTS}="suspend.target"}} should be used ideally, but it has to be combined with {{ic|1=TAG+="systemd"}}. | ||
:-- [[User:Lahwaacz|Lahwaacz]] ([[User talk:Lahwaacz|talk]]) 19:38, 26 September 2013 (UTC) | :-- [[User:Lahwaacz|Lahwaacz]] ([[User talk:Lahwaacz|talk]]) 19:38, 26 September 2013 (UTC) | ||
+ | |||
+ | ::Isn't the point that systemctl may not finish executing - certainly may not finish quickly enough for udev's liking? It is a matter of what is suitable in a udev rule due to the nature of udev. --[[User:Margali|cfr]] ([[User talk:Margali|talk]]) 01:47, 8 November 2013 (UTC) | ||
+ | |||
+ | == systemd-tmpfiles == | ||
+ | |||
+ | Re [https://wiki.archlinux.org/index.php?title=Laptop&diff=447520&oldid=447470], how is this any different from other tmpfiles entries? -- [[User:Alad|Alad]] ([[User talk:Alad|talk]]) 10:51, 23 August 2016 (UTC) | ||
+ | |||
+ | :For example in [[Maximizing_performance#systemd-tmpfiles]] you're writing the desired value to the "special" file, but here you're just toggling the state for the event you write to the file. It would work assuming that systemd-tmpfiles is run just once after boot, but that's not the case. -- [[User:Lahwaacz|Lahwaacz]] ([[User talk:Lahwaacz|talk]]) 11:05, 23 August 2016 (UTC) |
Latest revision as of 15:30, 11 April 2017
RUN+="<command>" won't work reliably
In the example:
/etc/udev/rules.d/lowbat.rules
# Suspend the system when battery level drops to 2% SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{capacity}=="2", RUN+="/usr/bin/systemctl suspend"
RUN ... Starting daemons or other long running processes is not appropriate for udev; the forked processes, detached or not, will be unconditionally killed after the event handling has finished.
There's no garantee that systemctl will finish execution. Its possible to use ENV{SYSTEMD_WANTS}="systemd-suspend.service"
but I have not personally tested this. All these udev rules should be reworked to trigger one-shot systemd services ideally, which also brings along all the benefits of have systemd units (logging, debugging, etc).
-- Simongmzlj
- First of all,
RUN+=
is not deprecated. Missing features do not predicate deprecation. I've removed the accuracy note from the page: [1]. - The
ENV{SYSTEMD_WANTS}="suspend.target"
should be used ideally, but it has to be combined withTAG+="systemd"
. - -- Lahwaacz (talk) 19:38, 26 September 2013 (UTC)
systemd-tmpfiles
Re [2], how is this any different from other tmpfiles entries? -- Alad (talk) 10:51, 23 August 2016 (UTC)
- For example in Maximizing_performance#systemd-tmpfiles you're writing the desired value to the "special" file, but here you're just toggling the state for the event you write to the file. It would work assuming that systemd-tmpfiles is run just once after boot, but that's not the case. -- Lahwaacz (talk) 11:05, 23 August 2016 (UTC)