systemctl start/stop service

systemctl is a Linux system service management tool for controlling system services. It can be used to start/shutdown/enable/disable system services.

1. Start the service:

systemctl start <服务名>

2. Close the service:

systemctl stop <服务名>

3. Enable the service:

systemctl enable <服务名>

After the service is enabled, the service will automatically start when the system starts

4. Disable the service:

systemctl disable <服务名>

When the service is disabled, the service will not start automatically at system boot.

5. Check whether it starts automatically after booting

systemctl is-enabled <服务名>

6. View the list of started services

systemctl list-unit-files|grep enabled

7. View the list of services that failed to start

systemctl --failed

In addition, systemctl can also:- View the current status of the service: systemctl status <service name>

  • Restart the service: systemctl restart <service name>
  • View all started services: systemctl list-units --type=service
  • Start the service according to the contents of the .service file: systemctl start <service configuration file path>

The systemctl tool simplifies the management of system services. We only need to remember a few simple commands to easily manage various services in the system. As a Linux system administrator, proficient use of systemctl is an essential skill.

Guess you like

Origin blog.csdn.net/qq_44534541/article/details/131070682