Start, stop, and check the status of network services

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
– To check whether a service is enabled:
 # systemctl is-enabled sshd

Starting and stopping services

service name startsystemctl start nameStarts a service
service name stopsystemctl stop nameStops a service
service name restartsystemctl restart nameRestarts a service
service name condrestartsystemctl try- restart nameRestarts a service only if it is running
service name reloadsystemctl reload nameReloads a configuration
service name statussystemctl status nameChecks whether a service is running
service –status- allsystemctl list-units –type service –allDisplays the status of all services

Enabling and disabling services

chkconfig name onsystemctl enable nameEnables a service
chkconfig name offsystemctl disable nameDisables a service
chkconfig –list namesystemctl status name, systemctl is-enabled nameChecks whether a service is enabled
chkconfig –listsystemctl list-unit-files –type serviceLists all services and checks whether they are enabled


Post a Comment