Compilation of Linux Service Configuration File

Service by writing the profile, you can use the Linux systemctlcommand to achieve the start management services, self-starting, stopping a particular purpose script process.

Writing method:
file naming: xxxx.service

[Unit]
Description=Frp Server Service		#服务的描述信息
After=network.target				#其中network.target代表有网路,network-online.target代表一个连通着的网络。

[Service]
Type=simple
User=nobody
Restart=1 			# 如果这个服务停止了,那么就重启
RestartSec=5s
ExecStart=/usr/bin/frps -c /etc/frp/frps.ini #服务的启动命令

[Install]
WantedBy=multi-user.target

After writing, copy this file to the /etc/systemd/system/directory, and then execute the following command:

systemctl enable xxx 		#开启这个服务的开机自启
systemctl start xxx		#启动服务
systemctl stop xxx 		#停止服务
systemctl status xxx 	#服务的运行信息 

Guess you like

Origin blog.csdn.net/jmh1996/article/details/109011816