1acpid(8) System Manager's Manual acpid(8)
2
3
4
6 acpid - Advanced Configuration and Power Interface event daemon
7
9 acpid [options]
10
11
13 acpid is designed to notify user-space programs of ACPI events. acpid
14 should be started during the system boot, and will run as a background
15 process, by default. It will open an events file (/proc/acpi/event by
16 default) and attempt to read whole lines which represent ACPI events.
17 If the events file does not exist, acpid will attempt to connect to the
18 Linux kernel via the input layer and netlink. When an ACPI event is
19 received from one of these sources, acpid will examine a list of rules,
20 and execute the rules that match the event. acpid will ignore all
21 incoming ACPI events if a lock file exists (/var/lock/acpid by
22 default).
23
24 Rules are defined by simple configuration files. acpid will look in a
25 configuration directory (/etc/acpi/events by default), and parse all
26 regular files with names that consist entirely of upper and lower case
27 letters, digits, underscores, and hyphens (similar to run-parts(8)).
28 Each file must define two things: an event and an action. Any blank
29 lines, or lines where the first character is a hash ('#') are ignored.
30 Extraneous lines are flagged as warnings, but are not fatal. Each line
31 has three tokens: the key, a literal equal sign, and the value. The
32 key can be up to 63 characters, and is case-insensitive (but whitespace
33 matters). The value can be up to 511 characters, and is case and
34 whitespace sensitive.
35
36 The event value is a regular expression (see regcomp(3)), against which
37 events are matched.
38
39 The action value is a commandline, which will be invoked via /bin/sh
40 whenever an event matching the rule in question occurs. The command‐
41 line may include shell-special characters, and they will be preserved.
42 The only special characters in an action value are "%" escaped. The
43 string "%e" will be replaced by the literal text of the event for which
44 the action was invoked. This string may contain spaces, so the comman‐
45 dline must take care to quote the "%e" if it wants a single token. The
46 string "%%" will be replaced by a literal "%". All other "%" escapes
47 are reserved, and will cause a rule to not load.
48
49 This feature allows multiple rules to be defined for the same event
50 (though no ordering is guaranteed), as well as one rule to be defined
51 for multiple events. To force acpid to reload the rule configuration,
52 send it a SIGHUP.
53
54 In addition to rule files, acpid also accepts connections on a UNIX
55 domain socket (/var/run/acpid.socket by default). Any application may
56 connect to this socket. Once connected, acpid will send the text of
57 all ACPI events to the client. The client has the responsibility of
58 filtering for messages about which it cares. acpid will not close the
59 client socket except in the case of a SIGHUP or acpid exiting.
60
61 For faster startup, this socket can be passed in as stdin so that acpid
62 need not create the socket. In addition, if a socket is passed in as
63 stdin, acpid will not daemonize. It will be run in foreground. This
64 behavior is provided to support systemd(1).
65
66 acpid will log all of its activities, as well as the stdout and stderr
67 of any actions, to syslog.
68
69 All the default files and directories can be changed with commandline
70 options.
71
72 When troubleshooting acpid, it is important to be aware that other
73 parts of a system might be handling ACPI events. systemd(1) is capable
74 of handling the power switch and various other events that are commonly
75 handled by acpid. See the description of HandlePowerKey in
76 logind.conf(5) for more. Some window managers also take over acpid's
77 normal handling of the power button and other events.
78
80 -c, --confdir directory
81 This option changes the directory in which acpid looks for
82 rule configuration files. Default is /etc/acpi/events.
83
84 -C, --clientmax number
85 This option changes the maximum number of non-root socket
86 connections which can be made to the acpid socket. Default
87 is 256.
88
89 -d, --debug This option increases the acpid debug level by one. If the
90 debug level is non-zero, acpid will run in the foreground,
91 and will log to stderr, in addition to the regular syslog.
92
93 -e, --eventfile filename
94 This option changes the event file from which acpid reads
95 events. Default is /proc/acpi/event.
96
97 -n, --netlink
98 This option forces acpid to use the Linux kernel input
99 layer and netlink interface for ACPI events.
100
101 -f, --foreground
102 This option keeps acpid in the foreground by not forking at
103 startup.
104
105 -l, --logevents
106 This option tells acpid to log information about all events
107 and actions.
108
109 -L, --lockfile filename
110 This option changes the lock file used to stop event pro‐
111 cessing. Default is /var/lock/acpid.
112
113 -g, --socketgroup groupname
114 This option changes the group ownership of the UNIX domain
115 socket to which acpid publishes events.
116
117 -m, --socketmode mode
118 This option changes the permissions of the UNIX domain
119 socket to which acpid publishes events. Default is 0666.
120
121 -s, --socketfile filename
122 This option changes the name of the UNIX domain socket
123 which acpid opens. Default is /var/run/acpid.socket.
124
125 -S, --nosocket filename
126 This option tells acpid not to open a UNIX domain socket.
127 This overrides the -s option, and negates all other socket
128 options.
129
130 -p, --pidfile filename
131 This option tells acpid to use the specified file as its
132 pidfile. If the file exists, it will be removed and over-
133 written. Default is /var/run/acpid.pid.
134
135 -v, --version
136 Print version information and exit.
137
138 -h, --help Show help and exit.
139
141 This example will shut down your system if you press the power button.
142
143 Create a file named /etc/acpi/events/power that contains the following:
144
145 event=button/power
146 action=/etc/acpi/power.sh "%e"
147
148 Then create a file named /etc/acpi/power.sh that contains the follow‐
149 ing:
150
151 /sbin/shutdown -h now "Power button pressed"
152
153 Now, when acpid is running, a press of the power button will cause the
154 rule in /etc/acpi/events/power to trigger the script in
155 /etc/acpi/power.sh. The script will then shut down the system.
156
158 acpid should work on any linux kernel released since 2003.
159
161 /proc/acpi/event
162 /dev/input/event*
163 /etc/acpi/
164 /var/run/acpid.socket
165 /var/run/acpid.pid
166 /var/lock/acpid
167
169 There are no known bugs. To file bug reports, see PROJECT WEBSITE
170 below.
171
173 regcomp(3), sh(1), socket(2), connect(2), init(1), systemd(1),
174 acpi_listen(8), kacpimon(8)
175
177 http://sourceforge.net/projects/acpid2/
178
180 Ted Felix (ted -at- tedfelix -dot- com)
181 Tim Hockin <thockin@hockin.org>
182 Andrew Henroid
183
184
185
186
187 acpid(8)