mirror of
https://github.com/juewuy/ShellCrash.git
synced 2024-11-16 11:42:18 +08:00
fcfbc29219
~本机代理功能增加iptables增强模式(仅支持Linux系统) ~优化iptables增强模式机制,修复潜在报错 ~修复mesh设备开机启动后shellclash无法正常工作的bug(待测试)
41 lines
923 B
Bash
41 lines
923 B
Bash
#!/bin/sh /etc/rc.common
|
|
|
|
START=101
|
|
|
|
SERVICE_DAEMONIZE=1
|
|
SERVICE_WRITE_PID=1
|
|
USE_PROCD=1
|
|
#获取目录
|
|
DIR=$(cat /etc/profile | grep clashdir | awk -F "\"" '{print $2}')
|
|
[ -z "$DIR" ] && DIR=$(cat ~/.bashrc | grep clashdir | awk -F "\"" '{print $2}')
|
|
BINDIR=$(cat $DIR/mark | grep bindir | awk -F "=" '{print $2}')
|
|
[ -z "$BINDIR" ] && BINDIR=$DIR
|
|
|
|
start_service() {
|
|
#检测必须文件
|
|
$DIR/start.sh bfstart
|
|
#使用procd创建clash后台进程
|
|
procd_open_instance
|
|
procd_set_param respawn
|
|
procd_set_param stderr 1
|
|
procd_set_param stdout 1
|
|
procd_set_param command $BINDIR/clash -d $BINDIR
|
|
procd_close_instance
|
|
#其他设置
|
|
$DIR/start.sh afstart
|
|
}
|
|
|
|
start() {
|
|
if [ -z "$(pidof procd)" ];then
|
|
#检测必须文件
|
|
$DIR/start.sh bfstart
|
|
#创建后台进程
|
|
service_start $BINDIR/clash -d $BINDIR
|
|
#其他设置
|
|
$DIR/start.sh afstart
|
|
#设置守护进程
|
|
$DIR/start.sh deamon
|
|
else
|
|
start_service
|
|
fi
|
|
} |