Linux Systemd - Start/Stop/Restart Services in RHEL / CentOS 7

One of the major changes in RHEL  / CentOS 7.0 is the swtich to systemd, a system and service manager, that replaces SysV and Upstart used in previous releases of Red Hat Enterprise Linux. systemd is compatible with SysV and Linux Standard Base init scripts.

Systemd is a system and service manager for Linux operating systems. It is designed to be backwards compatible with SysV init scripts, and provides a number of features such as parallel startup of system services at boot time, on-demand activation of daemons, support for system state snapshots, or dependency-based service control logic.

Previous versions of Red Hat Enterprise Linux, which were distributed with SysV init or Upstart, used init scripts written in bash located in the /etc/rc.d/init.d/ directory. In RHEL 7 / CentOS 7, these init scripts have been replaced with service units. Service units end with the .service file extension and serve a similar purpose as init scripts. To view, start, stop, restart, enable, or disable system services you will use the systemctl instead of the old service command.
Note: for backwards compatibility the old service command is still available in CentOS 7 and it will redirect any command to the new systemctl utility.

Start/Stop/Restart Services with systemctl

To start a service with systemctl you will need to use the command like this:

# systemctl start httpd.service

This will start the httpd service, in our case Apache HTTP Server.

To stop it use this command as root:

# systemctl stop httpd.service

To restart you can use either the restart options, it will restart the service if it's running or start it if it's not running. You can also use the try-restart option that will restart the service only if it's already running. Also you have the reload option that will reload the configuration files.

# systemctl restart httpd.service
# systemctl try-restart httpd.service
# systemctl reload httpd.service

The commands in our example look like this:

systemctl start-stop-restart

Checking the status of a service

To check the status of a service you can use the status option like this:

# systemctl status httpd.service

And the output should look like this:

systemctl status

Informing you of various aspects of the running service.

Enable / Disable services to run at boot time

You can also use the enable / disable options to make a service run at boot time, using the command like this:

# systemctl enable httpd.service
# systemctl disable httpd.service

The output looks like this:


Although the adoption of systemd has been very controversial in the last few years, slowly most of the major Linux distributions have either adopted or are planning to have it in the next point release, so it's a useful tool to get used to.

About Adrian Dinu

I’ve been a Linux enthusiast since 1998 and been working as a Linux Admin in the past 8 years with a lot of love for computers and networks.

Author Archive Page

Have anything to say?

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.


  1. Adrian, I found this post to be very, extremely helpful. My original search was to find an example of an httpd.service file (the only thing missing from your post). I don't know if I've got it right, but I put together an apache-httpd.service file after reading the man pages for systemd.service and systemctl - and countless web search results. What I came up with (seems to work) is the following:

    file: /etc/systemd/system/apache-httpd.service (symlink to /usr/lib/systemd/system/apache-httpd.service)

    ------ File Begins Here -----
    Description=Apache HTTPD Web Server

    ExecStart=/sbin/apachectl start
    ExecStop=/sbin/apachectl graceful-stop
    ExecReload=/sbin/apachectl graceful


    ------ File Ends Here -----

    Maybe this will help others stumbling around in the dark on this new (very cool) way to manage services...