1. 创建etc/systemd/system/clash.service
sudo vim /etc/systemd/system/clash.service
[Unit]
Description=clash service
After=network.target
[Service]
ExecStart=/usr/bin/clash -d /home/xiaxinkai/.config/clash/
[Install]
WantedBy=multi-user.target
2. systemctl配置开机启动
sudo systemctl daemon-reload # 刷新配置
sudo systemctl start clash # 启动clash.service
sudo systemctl enable clash # 设置开机启动
sudo systemctl status clash # 查看clash.service的状态
可以看到如下log:
xiaxinkai@tuf:~$ sudo systemctl status clash
[sudo] xiaxinkai 的密码:
● clash.service - clash service
Loaded: loaded (/etc/systemd/system/clash.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2022-03-17 23:15:55 CST; 23s ago
Main PID: 847 (clash)
Tasks: 19 (limit: 18925)
Memory: 17.7M
CGroup: /system.slice/clash.service
└─847 /usr/bin/clash -d /home/xiaxinkai/.config/clash/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)