CentOS 7 system service management tool systemctl introduction

A start, stop, restart service

Start the httpd service: systemctl start httpd.service
Stop the httpd service: systemctl stop httpd.service
Restart the httpd service: systemctl restart httpd.service
Restart the httpd service in the running state: systemctl condrestart httpd.service
Reload the httpd service configuration file: systemctl reload httpd.service
 
Second, view, prohibit, and start the service
Start the httpd service at boot: systemctl enable httpd.service
Disable httpd service at boot: systemctl disable httpd.service
View httpd service status: systemctl status  httpd.service
 
Comparison of three systemd commands and sysvinit commands
sysvinit command systemd command Remark
service httpd start systemctl start httpd.service start httpd service
service httpd stop systemctl stop httpd.service close httpd service
service httpd restart systemctl restart httpd.service Restart the httpd service, regardless of the current state of the httpd service
service httpd reload systemctl reload httpd.service Reload httpd configuration information without interrupting service
service httpd condrestart systemctl condrestart httpd.service Restart the httpd service. If it is already running, restart the httpd service. If it is not running, the service cannot be started.
service httpd status systemctl status httpd.service View the running status of the httpd service
chkconfig httpd on systemctl enable httpd.service Set the httpd service to start automatically at boot
chkconfig httpd off systemctl disable httpd.service Prevent httpd service from automatically starting at boot
chkconfig httpd systemctl is-enable httpd.service Check if the httpd service is enabled or disabled in the current environment
chkconfig --list systemctl list-unit-files --type=service Output whether all services are enabled or disabled at each run level
chkconfig httpd --list ls /etc/systemd/system/*.wants/httpd.service View the enabling and disabling of the httpd service at each run level
Four systemd power management commands
systemctl command meaning
systemctl poweroff shut down the system
systemctl reboot reboot the system
systemctl suspend enter standby mode
systemctl hibernate enter sleep mode
systemctl hybrid-sleep Enter Hybrid Sleep Mode

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326447032&siteId=291194637