CentOS 7 has switched to SYSTEMD and the system instructions have changed. Services that were previously used to start, restart, and stop the service as backward-compatible instructions can also be used, but may disappear in the future. At the same time, Chkconfig also changed into a systemctl. Here are some common new systemctl directives that correspond to service and chkconfig.
Service directives are still available in the current CentOS 7 (or RHEL 7) system. For example
[Email protected] ~]# service network restart
Restarting network (via Systemctl): [OK]
[Email protected] ~]# service httpd restart
Redirecting To/bin/systemctl restart Httpd.service
[[Email protected] ~]# service sshd restart
Redirecting To/bin/systemctl restart Sshd.service
However, the system will automatically redirect the instruction to the new instruction/bin/systemctl to execute and give a hint.
It's time to switch to the new instruction format and use Systemctl directly. This command means the system Contrl. Here are some common examples:
Start the service:
Systemctl Start httpd
Stop service:
Systemctl Stop httpd
Restart Service (stop first, start later):
Systemctl Restart httpd
Reload (with new configuration file):
Systemctl Reload httpd
Show Service Status:
Systemctl Status httpd
At the same time, previously used to set the system start automatically run a service instructions Chkconfig also changed, or with Systemctl.
Chkconfig Service on
Changed it,
Systemctl Enable httpd
Chkconfig Service off
Changed it,
Systemctl Disable httpd
Check the status of the service
Chkconfig Service
Changed it,
Systemctl is-enabled httpd
List the instructions for all the services,
Chkconfig–list
Changed it,
Systemctl List-unit-files--type=service
–levels, who used to specify the service RunLevel, is gone. adapt to it slowly.
CentOS 7.0 Systemd