linux中的service

服务编写

vim /lib/systemd/system/服务名.service

#例如frp的服务端

[Unit]
Description=fraps service
After=network.target syslog.target
Wants=network.target

[Service]
Type=simple
ExecStart=/root/frp/frps -c /root/frp/frps.ini  #此处安实际情况修改

[Install]
WantedBy=multi-user.target

#客户端运行服务创建:vi /lib/systemd/system/frpc.service

#qq机器人的服务
[Unit]
Description=qqbot

[Service]
Type=simple
ExecStart=/root/push_qq/go-cqhttp

[Install]
WantedBy=multi-user.target

设置开机自启

systemctl enable frp