自定义 systemd 服务
  obsidian link
# 使用systemctl启动服务
# 创建service文件
sudo vim /lib/systemd/system/xxx.service
 1
# 写入内容
[Unit]
Description=fraps service
After=network.target syslog.target
Wants=network.target
[Service]
Type=simple
#启动服务的命令,使用绝对路径, 此处以frp为例
ExecStart=/your/path/frps -c /your/path/frps.ini
[Install]
WantedBy=multi-user.target
 1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
# 启动
sudo systemctl start xxx
 1
# 打开自启动
sudo systemctl enable xxx
 1
重启应用
sudo systemctl restart xxx停止应用
sudo systemctl stop xxx查看应用的日志
sudo systemctl status xxx
# 其他服务后台运行方法
https://blog.csdn.net/x7418520/article/details/81077652 (opens new window)
编辑  (opens new window)
  上次更新: 2024/05/09, 12:51:17