CentOS 7 Use SYSTEMCTL to manage system services

Source: Internet
Author: User
The powerful Linux system service management tool that has recently come into contact with Systemctl, in addition to the 3 common instructions for System V, service, and Chkconfig, has a number of practical features that are commonly used below.
Utility Systemctl-help You can see that the command can be divided into the following sections: Part 1: Query or send control commands to SYSTEMD Services Section 2: Commands for Snap-in Services Part 3: Related commands for service files Parts 4: Tasks, environment, snapshot related commands Part 5 : SYSTEMD Service Configuration Overload Part 6: System open Machine related commands
1. List all available units # Systemctl List-unit-files
2. List all running units # Systemctl List-units
3. List all failed units # systemctl-failed
4. Check if a unit (such as Crond.service) is enabled # Systemctl Is-enabledcrond.service
5. List all services # Systemctl List-unit-files-type=service
6. How to start, restart, stop, overload services, and check services (such as Httpd.service) status in Linux # Systemctl start httpd.service # systemctl restart Httpd.service # sys Temctl Stop Httpd.service # systemctl Reload Httpd.service # systemctl Status Httpd.service Note: When we use Systemctl's Start,resta Rt,stop and Reload commands, the terminal does not output any content, only the status command can print the output.
7. How to activate the service and enable or disable the service at power-on (that is, start the Mysql.service service automatically when the system starts) # Systemctl is-active mysql.service # Systemctl enable Mysql.service # s Ystemctl Disable Mysql.service
8. How to screen (let it not start) or display services (such as Ntpdate.service) # Systemctl mask ntpdate.service ln-s '/dev/null '/etc/systemd/system/ Ntpdate.service ' # systemctl unmask ntpdate.service rm '/etc/systemd/system/ntpdate.service '
9. Kill service with systemctl command # Systemctl Killcrond
10. List all system mount points # Systemctl List-unit-files–type=mount
11. Mount, unload, Reload, overload system mount point and Check system mount point status # systemctl start Tmp.mount # systemctl Stop tmp.mount # systemctl Restart Tmp.mount # Systemctl Reload Tmp.mount # systemctl status Tmp.mount
12. Activate, enable, or disable mount points at startup (automatically mount at system startup) # Systemctl is-active tmp.mount # systemctl Enable Tmp.mount # systemctl Disable Tmp.mount
13. Screen in Linux (let it not enable) or visible mount point # Systemctl mask tmp.mount ln-s '/dev/null '/etc/systemd/system/tmp.mount ' # systemctl unmask Tmp.mount rm '/etc/systemd/system/tmp.mount '
14. List all available system socket interfaces # Systemctl List-unit-files–type=socket
15. Check all configuration details for a service # Systemctl Showmysql
16. Get a list of dependencies for a service (httpd) # Systemctl list-dependencies Httpd.service
17. Activate Rescue Mode # SYSTEMCTL Rescue
18. Enter Emergency mode # SYSTEMCTL Emergency
19. List The running level currently in use # Systemctl Get-default
20. Start Run Level 5, graphics mode # Systemctl isolate Runlevel5.target or # Systemctl isolate Graphical.target 21. Start Run Level 3, that is, multiuser mode (command line) # Systemctl isolate Runlevel3.target or # Systemctl isolate Multiuser.target
22. Set the multiuser mode or graphics mode to the default run level # Systemctl Set-default runlevel3.target # systemctl Set-default runlevel5.target
23. Reboot, stop, suspend, hibernate the system or bring the system into mixed sleep # systemctl reboot # Systemctl Halt # systemctl Suspend # systemctl Hibernate # Systemctl Hyb Rid-sleep
For those who do not know what the operating level is, the description is as follows. RunLevel 0: Shutdown system runlevel 1: Rescue, Maintenance Mode RunLevel 3: Multi-User, no graphics system RunLevel 4: Multiuser, no graphics system RunLevel 5: Multi-User, graphical system RunLevel 6: Off Shut and restart the machine



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.