One of the biggest and most flattering differences for managing services in systemd, atleast for me, is the fact that you only need to use one command line tool, systemctl(Be sure to check out the man page), whereas the traditional init system needs both chkconfig and service tools to manage services.
To see the list of available services on your machine, run the following command:
[root@localhost ~]# systemctl list-unit-files --type=service
***Additionally if you want to search for a specific service, feel free to grep for it.
In our case the httpd service is "httpd.service". To check to see if the service is running, use the following command:
[root@localhost ~]# systemctl status httpd.service
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/
Active: inactive (dead)
Note how descriptive the output is. The output gives a short couple of words on what the service is, if its loaded, if enabled/disabled for boot time and its state which in this case is not running. Note the output of the status of the httpd service after issuing start, stop and restart below.
To start the httpd service issue the start command:
[root@localhost ~]# systemctl start httpd.service
[root@localhost ~]# systemctl status httpd.service
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/ httpd.service; disabled)
Active: active (running) since Fri 2014-06-27 16:18:19 EDT; 6s ago
Main PID: 2049 (httpd)
Status: "Processing requests..."
CGroup: /system.slice/httpd.service
├─2049 /usr/sbin/httpd -DFOREGROUND
├─2050 /usr/sbin/httpd -DFOREGROUND
├─2051 /usr/sbin/httpd -DFOREGROUND
├─2052 /usr/sbin/httpd -DFOREGROUND
├─2053 /usr/sbin/httpd -DFOREGROUND
└─2054 /usr/sbin/httpd -DFOREGROUND
To start the httpd service issue the start command:
[root@localhost ~]# systemctl start httpd.service
[root@localhost ~]# systemctl status httpd.service
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/
Active: active (running) since Fri 2014-06-27 16:18:19 EDT; 6s ago
Main PID: 2049 (httpd)
Status: "Processing requests..."
CGroup: /system.slice/httpd.service
├─2049 /usr/sbin/httpd -DFOREGROUND
├─2050 /usr/sbin/httpd -DFOREGROUND
├─2051 /usr/sbin/httpd -DFOREGROUND
├─2052 /usr/sbin/httpd -DFOREGROUND
├─2053 /usr/sbin/httpd -DFOREGROUND
└─2054 /usr/sbin/httpd -DFOREGROUND
Jun 27 16:18:19 localhost.localdomain systemd[1]: Started The Apache HTTP Ser...
Hint: Some lines were ellipsized, use -l to show in full.
To stop the service run:
[root@localhost ~]# systemctl stop httpd.service
[root@localhost ~]# systemctl status httpd.service
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/ httpd.service; disabled)
Active: inactive (dead)
Jun 27 16:18:19 localhost.localdomain systemd[1]: Starting The Apache HTTP Se...
Jun 27 16:18:19 localhost.localdomain systemd[1]: Started The Apache HTTP Ser...
Jun 27 16:19:02 localhost.localdomain systemd[1]: Stopping The Apache HTTP Se...
Jun 27 16:19:03 localhost.localdomain systemd[1]: Stopped The Apache HTTP Ser...
Hint: Some lines were ellipsized, use -l to show in full.
To restart httpd, run below command:
[root@localhost ~]# systemctl restart httpd.service
[root@localhost ~]# systemctl status httpd.service
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/ httpd.service; disabled)
Active: active (running) since Fri 2014-06-27 16:19:31 EDT; 2s ago
Main PID: 2070 (httpd)
Status: "Processing requests..."
CGroup: /system.slice/httpd.service
├─2070 /usr/sbin/httpd -DFOREGROUND
├─2071 /usr/sbin/httpd -DFOREGROUND
├─2072 /usr/sbin/httpd -DFOREGROUND
├─2073 /usr/sbin/httpd -DFOREGROUND
├─2074 /usr/sbin/httpd -DFOREGROUND
└─2075 /usr/sbin/httpd -DFOREGROUND
Jun 27 16:19:31 localhost.localdomain systemd[1]: Started The Apache HTTP Ser...
Hint: Some lines were ellipsized, use -l to show in full.
Ill be doing a later segment on configuring boot time and runlevels (known as targets in systemd) in the near future but for the sake of this post let's take a look at enabling and disabling the service at Boot Time. To enable the httpd service to run at boot time, do the following:
[root@localhost ~]# systemctl enable httpd.service
ln -s '/usr/lib/systemd/system/ httpd.service' '/etc/systemd/system/multi- user.target.wants/httpd. service'
Note the service link to "multi- user.target.wants".
To remove the httpd service from running at boot time:
[root@localhost ~]# systemctl disable httpd.service
rm '/etc/systemd/system/multi- user.target.wants/httpd. service'
Note the service removal of the link that was created when the service was enabled.
This was just a very short introduction and overview into managing services in systemd using systemctl. There are several other things that you can do with systemctl such as kill processes and get a ton of information on them. Feel free to read its man page and as I mentioned above, Fedora's wiki page on systemd is a very good piece on using systemd. Please keep your eyes open as I will be posting a series of demos and discussions on systemd in the near future. Thanks for reading.
Hint: Some lines were ellipsized, use -l to show in full.
To stop the service run:
[root@localhost ~]# systemctl stop httpd.service
[root@localhost ~]# systemctl status httpd.service
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/
Active: inactive (dead)
Jun 27 16:18:19 localhost.localdomain systemd[1]: Starting The Apache HTTP Se...
Jun 27 16:18:19 localhost.localdomain systemd[1]: Started The Apache HTTP Ser...
Jun 27 16:19:02 localhost.localdomain systemd[1]: Stopping The Apache HTTP Se...
Jun 27 16:19:03 localhost.localdomain systemd[1]: Stopped The Apache HTTP Ser...
Hint: Some lines were ellipsized, use -l to show in full.
To restart httpd, run below command:
[root@localhost ~]# systemctl restart httpd.service
[root@localhost ~]# systemctl status httpd.service
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/
Active: active (running) since Fri 2014-06-27 16:19:31 EDT; 2s ago
Main PID: 2070 (httpd)
Status: "Processing requests..."
CGroup: /system.slice/httpd.service
├─2070 /usr/sbin/httpd -DFOREGROUND
├─2071 /usr/sbin/httpd -DFOREGROUND
├─2072 /usr/sbin/httpd -DFOREGROUND
├─2073 /usr/sbin/httpd -DFOREGROUND
├─2074 /usr/sbin/httpd -DFOREGROUND
└─2075 /usr/sbin/httpd -DFOREGROUND
Jun 27 16:19:31 localhost.localdomain systemd[1]: Started The Apache HTTP Ser...
Hint: Some lines were ellipsized, use -l to show in full.
Ill be doing a later segment on configuring boot time and runlevels (known as targets in systemd) in the near future but for the sake of this post let's take a look at enabling and disabling the service at Boot Time. To enable the httpd service to run at boot time, do the following:
[root@localhost ~]# systemctl enable httpd.service
ln -s '/usr/lib/systemd/system/
Note the service link to "multi-
To remove the httpd service from running at boot time:
[root@localhost ~]# systemctl disable httpd.service
rm '/etc/systemd/system/multi-
Note the service removal of the link that was created when the service was enabled.
This was just a very short introduction and overview into managing services in systemd using systemctl. There are several other things that you can do with systemctl such as kill processes and get a ton of information on them. Feel free to read its man page and as I mentioned above, Fedora's wiki page on systemd is a very good piece on using systemd. Please keep your eyes open as I will be posting a series of demos and discussions on systemd in the near future. Thanks for reading.