背景
Clash 每次都要手动执行命令启动,而且占住一个终端窗口不能关闭
实现
1. 创建 clash.service 文件
touch /etc/systemd/system/clash.service
2. 写入 clash.service ,记得替换路径,保存后退出
[Unit]
Description=clash daemon
[Service]
Type=simple
User=root
ExecStart=/opt/clash/clash -d /opt/clash/clash/
Restart=on-failure
[Install]
WantedBy=multi-user.target
3. 启动该服务
systemctl start clash.service
4. 设置开机自启动
systemctl enable clash.service
5. 重启,查看当前 Clash 运行状态,OK了
systemctl status clash.service


Comments NOTHING