Difference between revisions of "Daemons"

From ArchWiki
Jump to: navigation, search
(Starting on boot: new section: "Starting manually")
m
(9 intermediate revisions by 4 users not shown)
Line 3: Line 3:
 
[[cs:Daemon]]
 
[[cs:Daemon]]
 
[[de:Daemons]]
 
[[de:Daemons]]
 +
[[es:Daemon]]
 
[[it:Daemon]]
 
[[it:Daemon]]
 
[[pl:Daemon]]
 
[[pl:Daemon]]
Line 9: Line 10:
 
[[tr:Artsüreç]]
 
[[tr:Artsüreç]]
 
[[zh-CN:Daemon]]
 
[[zh-CN:Daemon]]
A [[Wikipedia:Daemon (computing)|daemon]] is a program that runs in the background, waiting for events to occur and offering services. A good example is a web server that waits for a request to deliver a page or a ssh server waiting for someone trying to log in. While these are full featured applications, there are daemons whose work is not that visible. Daemons are for tasks like writing messages into a log file (e.g. {{ic|syslog}}, {{ic|metalog}}) or keeping your system time accurate (e.g. [[Network Time Protocol daemon|{{ic|ntpd}}]]). For more information see {{ic|man 7 daemon}}.
+
A [[Wikipedia:Daemon (computing)|daemon]] is a program that runs as a "background" process (without a terminal or user interface), commonly waiting for events to occur and offering services. A good example is a web server that waits for a request to deliver a page, or a ssh server waiting for someone trying to log in. While these are full featured applications, there are daemons whose work is not that visible. Daemons are for tasks like writing messages into a log file (e.g. {{ic|syslog}}, {{ic|metalog}}) or keeping your system time accurate (e.g. [[Network Time Protocol daemon|{{ic|ntpd}}]]). For more information see {{ic|man 7 daemon}}.
  
 
{{Note|The word daemon is sometimes used for a class of programs that are started at boot but have no process which remains in memory.  They are called daemons simply because they utilize the same startup/shutdown framework (e.g. systemd service files of Type oneshot) used to start traditional daemons.  For example, the service files for {{ic|alsa-store}} and {{ic|alsa-restore}} provide persistent configuration support but do not start additional background processes to service requests or respond to events.
 
{{Note|The word daemon is sometimes used for a class of programs that are started at boot but have no process which remains in memory.  They are called daemons simply because they utilize the same startup/shutdown framework (e.g. systemd service files of Type oneshot) used to start traditional daemons.  For example, the service files for {{ic|alsa-store}} and {{ic|alsa-restore}} provide persistent configuration support but do not start additional background processes to service requests or respond to events.
Line 16: Line 17:
 
}}
 
}}
  
==Systemd system==
+
==Managing daemons==
 +
In Arch Linux, daemons are managed by [[systemd]]. The [[systemd#Basic systemctl usage|systemctl]] command is the user interface used to manage them. It reads ''<service>''.service files that contain information about how and when to start the associated daemon. Service files are stored in {{ic|/{etc,usr/lib,run}/systemd/system}}. See [[systemd#Using units]] for complete information about using systemctl to manage daemons.
  
 
===Starting on boot===
 
===Starting on boot===
A default install of Arch Linux will leave you with very few services (or daemons) enabled during boot. You can add or remove services to be started on boot by calling
+
To add or remove services to be started at boot-time, use {{ic|systemctl enable<nowiki>|</nowiki>disable ''<service_name>''}}
 
+
# systemctl enable <name>
+
 
+
or
+
 
+
# systemctl disable <name>
+
 
+
The services themselves contain the necessary ordering information, so there is no need to order them manually.
+
 
+
Service files are stored in {{ic|/{etc,usr/lib,run}/systemd/system}}. You can print the list of all the available services on your system, along with their current status, with:
+
$ systemctl list-unit-files
+
 
+
To see a list of running units (some of which will be daemons, among other things), type:
+
$ systemctl list-units
+
 
+
To see all available ones, add {{ic| --all}} to the end of a command.
+
  
 
===Starting manually===
 
===Starting manually===
To start or stop services at runtime, you can replace {{ic|enable}}/{{ic|disable}} with {{ic|start}}/{{ic|stop}} in the above command.
+
To start or stop services at runtime, use {{ic|systemctl start<nowiki>|</nowiki>stop ''<service_name>''}}.
  
You can read more at the [[Systemd#Administrative_commands]] section.
+
===Restarting===
 +
To restart services, use {{ic|systemctl restart ''<service_name>''}}.
  
===Essentials===
+
===Status reporting===
You do not have to add any more services, if you do not feel the need. However, a typical desktop user will add at least [[CUPS]] and a desktop manager such as [[gdm]] or [[KDM|kdm]]. As you install new services, you will have to manually enable them if you want them to be started on boot.
+
To report the current status of a service, use {{ic|systemctl status ''<service_name>''}}.
  
==List of Daemons==
+
==List of daemons==
 
See [[Daemons List]] for a list of daemons with the name of the service and legacy rc.d script.
 
See [[Daemons List]] for a list of daemons with the name of the service and legacy rc.d script.
  

Revision as of 12:01, 20 November 2012

A daemon is a program that runs as a "background" process (without a terminal or user interface), commonly waiting for events to occur and offering services. A good example is a web server that waits for a request to deliver a page, or a ssh server waiting for someone trying to log in. While these are full featured applications, there are daemons whose work is not that visible. Daemons are for tasks like writing messages into a log file (e.g. syslog, metalog) or keeping your system time accurate (e.g. ntpd). For more information see man 7 daemon.

Note: The word daemon is sometimes used for a class of programs that are started at boot but have no process which remains in memory. They are called daemons simply because they utilize the same startup/shutdown framework (e.g. systemd service files of Type oneshot) used to start traditional daemons. For example, the service files for alsa-store and alsa-restore provide persistent configuration support but do not start additional background processes to service requests or respond to events.

From the user's perspective the distinction is typically not significant unless the user tries to look for the "daemon" in a process list.

Managing daemons

In Arch Linux, daemons are managed by systemd. The systemctl command is the user interface used to manage them. It reads <service>.service files that contain information about how and when to start the associated daemon. Service files are stored in /{etc,usr/lib,run}/systemd/system. See systemd#Using units for complete information about using systemctl to manage daemons.

Starting on boot

To add or remove services to be started at boot-time, use systemctl enable|disable <service_name>

Starting manually

To start or stop services at runtime, use systemctl start|stop <service_name>.

Restarting

To restart services, use systemctl restart <service_name>.

Status reporting

To report the current status of a service, use systemctl status <service_name>.

List of daemons

See Daemons List for a list of daemons with the name of the service and legacy rc.d script.

See also