全球主机交流论坛

标题: 已解决,openclash如何定时关闭,定时启动? [打印本页]

作者: fule    时间: 2023-9-9 11:49
标题: 已解决,openclash如何定时关闭,定时启动?
本帖最后由 fule 于 2023-9-10 20:21 编辑

需求是这样的:
因为要优选cf的ip,所以路由器开着openclash时不能用
需要关闭openclash,然后跑优选ip的程序。

我现在是想在软路由上,定时关闭openclash,然后启动优选ip的程序,之后定时开启openclash

有没有大佬指点一下,openclash定时关闭、定时启动这部分怎么搞,官方只给了restart命令

开启:
uci set openclash.config.enable='1'
uci commit openclash
/etc/init.d/openclash start

关闭:
uci set openclash.config.enable='0'
uci commit openclash
/etc/init.d/openclash stop

放到sh里,写定时任务就行了
比如:
10 6 * * * /root/openclash_cron/start_openclash.sh
每天六点十分运行
作者: 笑花落半世琉璃    时间: 2023-9-9 12:17
自己写个shell 扔crontab里面
作者: fule    时间: 2023-9-9 12:23
笑花落半世琉璃 发表于 2023-9-9 12:17
自己写个shell 扔crontab里面

对 ,但我没找到openclash的关闭命令,现在想的是把有clash的都kill掉,然后启动的时候调用restart,但感觉太暴力了
作者: dupit8    时间: 2023-9-9 23:52
优先IP的程序不走open clash即可,干嘛非要搞那么麻烦
作者: fule    时间: 2023-9-10 01:33
dupit8 发表于 2023-9-9 23:52
优先IP的程序不走open clash即可,干嘛非要搞那么麻烦


试过把cf的ip段加进规则走直连,上网会有问题
至于优选ip程序不走oc,请问下大佬有这种设置吗
作者: fule    时间: 2023-9-10 20:22
解决了,主贴已更新
作者: dupit8    时间: 2023-9-11 21:08
fule 发表于 2023-9-10 01:33
试过把cf的ip段加进规则走直连,上网会有问题
至于优选ip程序不走oc,请问下大佬有这种设置吗 ...

走单独路由表/iptables选择跳过对应的uid.




欢迎光临 全球主机交流论坛 (https://sunk.eu.org/) Powered by Discuz! X3.4