Service_management
systemd
systemd allows you to create and manage services in extremely powerful and flexible ways.
Unit files
If you're creating a brand new unit file for your service, you must first come up with a name. The name you select must not collide with any existing service name.
Create your service's unit file with the ".service" suffix in the /etc/systemd/system directory. In our example, we will be creating a /etc/systemd/system/myservice.service file.
The first thing you must identify is what type of service you will be managing. Most services should use the simple type, which means a program that runs in the foreground. If your service normally runs itself in the background, search the documentation to see if it has an option to disable that. Running in the foreground is preferred.
command
- systemctl start service
- systemctl status 命令查看一下该服务的状态
- 终止正在运行的服务,需要执行systemctl stop命令