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 acpid will log all of its activities, as well as the stdout and stderr
62 of any actions, to syslog.
63
64 All the default files and directories can be changed with commandline
65 options.
66
68 -c, --confdir directory
69 This option changes the directory in which acpid looks for
70 rule configuration files. Default is /etc/acpi/events.
71
72 -C, --clientmax number
73 This option changes the maximum number of non-root socket
74 connections which can be made to the acpid socket. Default
75 is 256.
76
77 -d, --debug This option increases the acpid debug level by one. If the
78 debug level is non-zero, acpid will run in the foreground,
79 and will log to stderr, in addition to the regular syslog.
80
81 -e, --eventfile filename
82 This option changes the event file from which acpid reads
83 events. Default is /proc/acpi/event.
84
85 -n, --netlink
86 This option forces acpid to use the Linux kernel input
87 layer and netlink interface for ACPI events.
88
89 -f, --foreground
90 This option keeps acpid in the foreground by not forking at
91 startup.
92
93 -l, --logevents
94 This option tells acpid to log information about all events
95 and actions.
96
97 -L, --lockfile filename
98 This option changes the lock file used to stop event pro‐
99 cessing. Default is /var/lock/acpid.
100
101 -g, --socketgroup groupname
102 This option changes the group ownership of the UNIX domain
103 socket to which acpid publishes events.
104
105 -m, --socketmode mode
106 This option changes the permissions of the UNIX domain
107 socket to which acpid publishes events. Default is 0666.
108
109 -s, --socketfile filename
110 This option changes the name of the UNIX domain socket
111 which acpid opens. Default is /var/run/acpid.socket.
112
113 -S, --nosocket filename
114 This option tells acpid not to open a UNIX domain socket.
115 This overrides the -s option, and negates all other socket
116 options.
117
118 -p, --pidfile filename
119 This option tells acpid to use the specified file as its
120 pidfile. If the file exists, it will be removed and over-
121 written. Default is /var/run/acpid.pid.
122
123 -v, --version
124 Print version information and exit.
125
126 -h, --help Show help and exit.
127
129 This example will shut down your system if you press the power button.
130
131 Create a file named /etc/acpi/events/power that contains the following:
132
133 event=button/power
134 action=/etc/acpi/power.sh "%e"
135
136 Then create a file named /etc/acpi/power.sh that contains the follow‐
137 ing:
138
139 /sbin/shutdown -h now "Power button pressed"
140
141 Now, when acpid is running, a press of the power button will cause the
142 rule in /etc/acpi/events/power to trigger the script in
143 /etc/acpi/power.sh. The script will then shut down the system.
144
146 acpid should work on any linux kernel released since 2003.
147
149 /proc/acpi/event
150 /dev/input/event*
151 /etc/acpi/
152 /var/run/acpid.socket
153 /var/run/acpid.pid
154 /var/lock/acpid
155
157 There are no known bugs. To file bug reports, see AUTHORS below.
158
160 regcomp(3), sh(1), socket(2), connect(2)
161
163 Ted Felix (www.tedfelix.com)
164 Tim Hockin <thockin@hockin.org>
165 Andrew Henroid
166
167
168
169
170 acpid(8)