Usage of systemctl on centos 7
We are familiar with both the service and chkconfig commands. systemctl is the main tool for service control. It integrates the functions of chkconfig and service.
Systemctl is-enabled iptables. Service
Systemctl is-enabled servicename. Service # query whether the service is started
Systemctl enable *. Service # Start the service
Systemctl disable *. Service # cancel startup
Systemctl start *. Service # Start the service
Systemctl stop *. Service # Stop the service
Systemctl restart *. Service # restart the service
Systemctl reload *. Service # reload the service configuration file
Systemctl status *. Service # query the service running status
Systemctl -- failed # displays services that fail to be started
Note: * indicates the name of a service. For example, the HTTP service name is httpd.
For example, install HTTP on centos 7
[[Email protected] ~] # Yum-y install httpd
Start the Service (equivalent to service httpd start)
Systemctl start httpd. Service
Stop a service (equivalent to service httpd stop)
Systemctl stop httpd. Service
Restart the Service (equivalent to httpd restart)
Systemctl restart httpd. Service
Check whether the service is running (equivalent to service httpd status)
Systemctl status httpd. Service
Auto-Start Service (equivalent to chkconfig httpd on)
Systemctl enable httpd. Service
Disable the service at startup (equivalent to chkconfig httpd on)
Systemctl disable httpd. Service
Check whether the service is started (equivalent to chkconfig -- List)
Usage of systemctl on centos 7