Starting and stopping systemd services

Although this recipe uses services by their base name, they can also be addressed by their full filename. For example, sshd can be substituted by sshd.service.

How to do it…

The following steps need to be performed to successfully start or stop systemd services:

  1. List all available systemd services, as follows:
    ~]# systemctl list-unit-files --type service
    UNIT FILE                                   STATE   
    atd.service                                 enabled
    auditd.service                              enabled
    auth-rpcgss-module.service                  static  
    autovt@.service                             disabled
    avahi-daemon.service                        disabled
    blk-availability.service                    disabled
    brandbot.service                            static  
    
    ...
    
    systemd-udev-trigger.service                static  
    systemd-udevd.service                       static  
    systemd-update-utmp-runlevel.service        static  
    systemd-update-utmp.service static ...

Get Linux: Powerful Server Administration now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.