CentOS 7 systemd command
CentOS 7The system commands have been switched to systemd. Previously Used to start, restart, and stop various servicesservice
It can be used as backward compatible commands, but may disappear in the future. At the same time,chkconfig
Changedsystemctl
. Some common examples are as follows:service
Andchkconfig
Newsystemctl
Command.
In the current CentOS 7 (or RHEL 7) systemservice
Command. For example,
[root@localhost ~]# service network restart Restarting network (via systemctl): [ OK ] [root@localhost ~]# service httpd restart Redirecting to /bin/systemctl restart httpd.service [root@localhost ~]# service sshd restart Redirecting to /bin/systemctl restart sshd.service
However, the system automatically redirects the command to the new command./bin/systemctl
And give a prompt.
It's time to switch to the new instruction format.systemctl
Right. This command indicates system contrl. Below are some common examples:
Start the service:
systemctl start httpd
Stop Service:
systemctl stop httpd
Restart the Service (stop first and then start ):
systemctl restart httpd
Reload (use the new configuration file ):
systemctl reload httpd
Display service status:
systemctl status httpd
At the same time, commands used to set automatic running of a service during system startupchkconfig
Also changed, or usedsystemctl
.
chkconfig service on
Changed,
systemctl enable httpd
chkconfig service off
Changed,
systemctl disable httpd
Check the service status
chkconfig service
Changed,
systemctl is-enabled httpd
List the commands of all services,
chkconfig –list
Changed,
systemctl list-unit-files --type=service
The-levels that can previously specify the service runlevel does not exist. Take it easy.