How To Use acpid Command In Linux

acpid command basically offer users to deal with intelligent power management on a system and allows them to query batter and other configuration status by supporting ACPI. Basically, this command is designed to notify user-space programs of ACPI events.

Technically, acpid should be started just after the system boot. It runs in system background as a process by default. When this command runs, it open and reads a file saved at /proc/acpi/event which represents ACPI events. Means, in case if the file is found as non-existing, the acpid will try to connect to Linux kernel through input layer and netlink.

In such instances, if the command finds an ACPI event, it will examine the list of rules and execute the rules as well that matches to event. Also, acpid will ignore all incoming ACPI events as well if it finds a lock file within /var/lock/acpid directory.

acpid uses simple configuration files to define the rules. This configuration file are actually saved within /etc/acpi/events by default. The command will look for this directory, and all files which are prefixed with “.” and suffixed by “~” will be parsed. Also, if it finds any lines in file starting with “#”, will be considered as comment and will be ignored.

In order to install acpid, the users can run the following command:

sudo apt-get install acpid

Here comes the syntax to use acpid:

acpid [options]

Available options to use with acpid:

  • -c | -confdir directory: changes the defined directory in which the acpid looks for rules configuration files.
  • -c | clientmax number: modifies the number of non-root socket connections which can be made to acpid socket. The default set number is 256.
  • -d | -debug: It increases the acpid debug level by one. In case if the debug level is not zero, the acpid will run in foreground and will record logs to stderr in addition with regular syslog.
  • -e | -eventfile filename: Allows the change the event file from which the acpid can read the events.
  • -n | -netlink: It enforces the acpid to utilize Linux kernel input layer and netlink interface for ACPI events
  • -f | -foreground: Allows to run acpid running in foreground by not forking at boot.
  • -l | -logevents: Tells the acpid to log all information about events and actions.
  • -L | -lockfile filename: Modifies the lock file used to abort event processing.
  • -g | -socketgroup groupname: Modifies the group ownership of Unix domain socket to which acpid publishes events.
  • -m | -socketmode mode: Alters the permissions to Unix domain socket. The default socket used by acpid is 0666.
  • -s | -socketfile filename: Changes the name of Unix domain socket opened by acpid.
  • S | -nosocket filename: Informs acpid to open not a Unix domain socket, also it negates all other socket options.
  • -p | pidfile filename: Informs acpid to utilize a specified file name as pidfile. In case if file is found existing, it will be emoved of overwritten.
  • -V | -version: Displays the version related information and exits.
  • -h | -help: Displays help information and exits.

Syntax to control acpid service

service acpid status

Checks for acpid current status if it’s running or not.

service acpid start

Used to start the acpid service, which will also ask you for root user authentication.

service acpid stop

Stops the acpid service.