acpid - Advanced Configuration and Power Interface event daemon
Rules are defined by simple configuration files. acpid will look in a configuration directory (/etc/acpi/events by default), and parse all files that do not begin with a period ('.'). Each file must define two things: an event and an action. Any blank lines, or lines where the first character is a pound sign ('#') are ignored. Extraneous lines are flagged as warnings, but are not fatal. Each line has three tokens: the key, a literal equal sign, and the value. The key can be up to 63 characters, and is case-insensitive (but whitespace matters). The value can be up to 511 characters, and is case and whitespace sensitive.
The event value is a regular expression (see regcomp(3)), against which events are matched.
The action value is a commandline, which will be invoked via /bin/sh whenever an event matching the rule in question occurs. The commandline may include shell-special characters, and they will be preserved. The only special characters in an action value are "%" escaped. The string "%e" will be replaced by the literal text of the event for which the action was invoked. This string may contain spaces, so the commandline must take care to quote the "%e" if it wants a single token. The string "%%" will be replaced by a literal "%". All other "%" escapes are reserved, and will cause a rule to not load.
This feature allows multiple rules to be defined for the same event (though no ordering is guaranteed), as well as one rule to be defined for multiple events. To force acpid to reload the rule configuration, send it a SIGHUP.
In addition to rule files, acpid also accepts connections on a UNIX domain socket (/var/run/acpid.socket by default). Any application may connect to this socket. Once connected, acpid will send the text of all ACPI events to the client. The client has the responsibility of filtering for messages about which it cares. acpid will not close the client socket except in the case of a SIGHUP or acpid exiting.
acpid will log all of it's activities, as well as the stdout and stderr of any actions to a log file (/var/log/acpid by default).
All the default file and directories can be changed with commandline options.
event=button/power.*
action=/usr/local/sbin/power.sh "%e"
The script power.sh gets called and will see the complete event string as parameter $1.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |