systemd service units
– Previous versions of Oracle Linux use scripts in the /etc/rc.d/init.d directory to control services.
– In Oracle Linux 7, these scripts have been replaced by systemd service units.
– Use the systemctl command to list information about service units.
To list all loaded service units:
# systemctl list-units --type service --all
To see which service units are enabled:
# systemctl list-unit-files --type service
Displaying the Status of Services
– systemd service units correspond to system services.
– To display detailed information about the httpd service:
# systemctl status httpd
– 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
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
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 |