Previous versions of Oracle Linux use init scripts located in the
# systemctl list-units --type service --all UNIT LOAD ACTIVE SUB DESCRIPTION auditd.service loaded active running Security Auditing Service avahi-daemon.service loaded active running Avahi mDNS/DNS-SD Stack .....
LOAD – service load state
high-level (ACTIVE) and low-level (SUB) unit activation state
DESCRIPTION – description of the service unit.
Omit the –all option to list only the active service units. Use the list-unit-files option to see which service units are enabled:
# systemctl list-unit-files --type service
Displaying status of the services
systemd service units correspond to system services. Use the following command to display detailed information about a service unit. This example displays information about the sshd service unit.
# systemctl status sshd
The following information is available for the specified service unit:
Loaded: If the service is loaded, the absolute path to the service unit file, and if the service unit is enabled Active: If the service unit is running and a timestamp Main PID: The Process ID of the corresponding system service and the service name Status: Additional information about the corresponding system service Process: Additional information about related processes CGroup: Additional information about related Control Groups
To check whether a service is running (active) or not running (inactive):
# systemctl is-active sshd active
To check whether a service is enabled:
# systemctl is-enabled sshd enabled
Starting and Stopping Services
In previous versions of RHEL, the service utility is used to stop and start services. In RHEL 7, the systemctl utility provides an equivalent set of subcommands. The table below shows a comparison of the service utility with systemctl.
|service Utility||systemctl Utility||Description|
|service name start||systemctl start name||Starts a service|
|service name stop||systemctl stop name||Stops a service|
|service name restart||systemctl restart name||Restarts a service|
|service name condrestart||systemctl try- restart name||Restarts a service only if it is running|
|service name reload||systemctl reload name||Reloads a configuration|
|service name status||systemctl status name||Checks whether a service is running|
|service –status- all||systemctl list-units –type service –all||Displays the status of all services|
Enabling and disabling services
In previous versions of RHEL, the chkconfig utility is used to enable and disable services. In RHEL 7, the systemctl utility provides an equivalent set of subcommands. The table below shows a comparison of the chkconfig utility with systemctl.
|chkconfig Utility||systemctl Utility||Description|
|chkconfig name on||systemctl enable name||Enables a service|
|chkconfig name off||systemctl disable name||Disables a service|
|chkconfig –list name||systemctl status name, systemctl is-enabled name||Checks whether a service is enabled|
|chkconfig –list||systemctl list-unit-files –type service||Lists all services and checks whether they are enabled|