Configure Services

[1] It's possible to display services' status like follows.

[root@localhost ~]# systemctl -t service
UNIT                           LOAD   ACTIVE SUB     DESCRIPTION
auditd.service                 loaded active running Security Auditing Service
crond.service                  loaded active running Command Scheduler
dbus-daemon.service            loaded active running D-Bus System Message Bus
dovecot.service                loaded active running Dovecot IMAP/POP3 email server
dracut-shutdown.service        loaded active exited  Restore /run/initramfs on shutdown
firewalld.service              loaded active running firewalld - dynamic firewall daemon
[email protected]             loaded active running Getty on tty1           
httpd.service                  loaded active running The Apache HTTP Server
import-state.service           loaded active exited  Import network configuration from initramfs
...

[2] List of all services.

[root@localhost ~]# systemctl list-unit-files -t service
UNIT FILE                                  STATE
arp-ethers.service                         disabled
auditd.service                             enabled
[email protected]                            enabled
blk-availability.service                   disabled
bluetooth.service                          enabled
brltty.service                             disabled
[email protected]                      static
canberra-system-bootup.service             disabled
canberra-system-shutdown-reboot.service    disabled
canberra-system-shutdown.service           disabled
[email protected]                 static
console-getty.service                      disabled
[email protected]                   static
cpupower.service                           disabled
crond.service                              enabled
...

[3] Stop and turn OFF auto-start setting for a service if you don'd need it. (it's bluetooth as an example below)

[root@localhost ~]# systemctl stop bluetooth
[root@localhost ~]# systemctl disable bluetooth

[4] View the status of a service.

[root@localhost ~]# systemctl status crond
● crond.service - Command Scheduler
   Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2021-09-24 03:30:06 +03; 18h ago
 Main PID: 1755 (crond)
    Tasks: 1 (limit: 4915)
   Memory: 2.1M
   CGroup: /system.slice/crond.service
           └─1755 /usr/sbin/crond -n

Sep 24 13:01:01 localhost.localdomain CROND[30121]: (root) CMD (run-parts /etc/cron.hourly)
Sep 24 14:01:01 localhost.localdomain CROND[22819]: (root) CMD (run-parts /etc/cron.hourly)
...

[5] Start a service and add it to startup services.

[root@localhost ~]# systemctl start httpd
[root@localhost ~]# systemctl enable httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.

[6] Restart a service.

[root@localhost ~]# systemctl restart crond

[7] Check that a service has been added to the startup services.

[root@localhost ~]# systemctl is-enabled postfix
enabled

[8] Check the running status of a service.

[root@localhost ~]# systemctl is-active bluetooth
inactive