Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

重启路由后SSR链接会断开,需要重启SS才行 #14

Open
alx2017 opened this issue Jul 24, 2017 · 11 comments
Open

重启路由后SSR链接会断开,需要重启SS才行 #14

alx2017 opened this issue Jul 24, 2017 · 11 comments

Comments

@alx2017
Copy link

alx2017 commented Jul 24, 2017

有检测连接状态并重启SS的脚本吗?
shadowsocks 1.2.7

@brucezhiyue
Copy link

你说的这个情况,加到开机启动就可以了吧?

如果想定时重启加到crontab就可以了。

怎么加,我就没试过了。

@Edelwiess
Copy link

能大概讲讲思路吗?应该加哪个sh文件到crontab?

@Edelwiess
Copy link

重启时调用的是\jffs\koolshare\ss\start.sh 脚本。

@Edelwiess
Copy link

找到2行代码。但是我看不懂,是怎么实现开机启动的,希望能加个延迟,开机1分钟后再开启ss

nat_auto_start(){
echo_date 添加nat-start触发事件...
[ ! -L "$KSROOT/init.d/N98shadowsocks.sh" ] && ln -sf $KSROOT/ss/start.sh "$KSROOT"/init.d/N98shadowsocks.sh
}
#--------------------------------------------------------------------------------------
wan_auto_start(){
echo_date 加入开机自动启动...
[ ! -L "$KSROOT/init.d/N98shadowsocks.sh" ] && ln -sf $KSROOT/scripts/ss_config.sh "$KSROOT"/init.d/N98shadowsocks.sh
}

@Edelwiess
Copy link

根据Moudule_shadowsocks.asp
按下提交按钮后,执行的是ss_config.sh

@Edelwiess
Copy link

How can I add a cron job?[toc, link]
Use a utility called "cru". Examples:

cru

add: cru a <"min hour day month week command">
delete: cru d
list: cru l

cru a TwiceMonthlyReboot "0 3 1,15 * * reboot"

(03:00, 1st and 15th of every month)

cru a SundayWanRestart "0 2 * * 0 service wan restart"

(02:00, every Sunday)

cru a NightLightOn "0 20 * * * led white on aoss on"

(20:00 everyday)

cru a NightLightOff "0 6 * * * led white off aoss off"

(06:00 everyday)
If you'd rather do this manually: Tomato uses Busybox's crond implementation which doesn't use the same files as the ones found in DD-WRT or HyperWRT (Vixie). The cron file is in /var/spool/cron/crontabs/root.

@Edelwiess
Copy link

发现一个可能有用的办法
Administration
Scripts
Event Scripts
Wan up

#Do not delete ks-wan-start.sh! It's very important for software center!!!
/jffs/koolshare/bin/ks-wan-start.sh
#加入了一行负责ss启动的
/jffs/koolshare/scripts/ss_config.sh

@Edelwiess
Copy link

/jffs/koolshare/scripts/ss_config.sh start

@qinqing2015
Copy link

qinqing2015 commented Dec 26, 2017

可以把以下脚本放到计划任务里,设置每分钟执行一次。

#!/bin/sh
#检测国外链接
get_foreign_status(){
wget -4 --spider --quiet --tries=2 --timeout=2 www.google.com.tw
if [ "$?" != "0" ]; then
/jffs/koolshare/scripts/ss_config.sh start
fi
}
#运行函数
get_foreign_status

@sunnoy
Copy link

sunnoy commented Apr 20, 2018

固件版本为7.8
在文件目录内/koolshare/scripts/dong.sh,建立脚本dong.sh该脚本名称可以随意

#更改用户组
chown admin:root dong.sh
#更改权限
chmod 755 dong.sh

添加了重启日志

#!/bin/sh

get_foreign_status()

{
  wget -4 --spider --quiet --tries=2 --timeout=2 www.google.com.tw
  time=$(date +%Y-%m-%d-%X)
  if [ "$?" != "0" ]; then
     /koolshare/ss/ssconfig.sh restart
    echo "$time ssr restart" >> ssrlog
  fi
}


get_foreign_status

添加重启脚本

#此为添加定时任务
cru a ssrestart 1 * * * * /bin/sh /koolshare/scripts/dong.sh



@wgjwillis
Copy link

wget -4 --spider --quiet --tries=2 --timeout=2 www.google.com.tw

root@koolshare:/jffs/koolshare# wget -4 --spider --quiet --tries=2 --timeout=2 www.google.com.tw
wget: invalid option -- 4
BusyBox v1.25.1 (2017-05-24 11:57:52 CST) multi-call binary.

Usage: wget [-csq] [-O FILE] [-Y on/off] [-P DIR] [-U AGENT] [-T SEC] URL...

Retrieve files via HTTP or FTP

        -s      Spider mode - only check file existence
        -c      Continue retrieval of aborted transfer
        -q      Quiet
        -P DIR  Save to DIR (default .)
        -T SEC  Network read timeout is SEC seconds
        -O FILE Save to FILE ('-' for stdout)
        -U STR  Use STR for User-Agent header
        -Y      Use proxy ('on' or 'off')

没有一些参数~~
请问如何解决?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants