Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
blog
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacksgong
blog
Commits
bccee9d2
Commit
bccee9d2
authored
Feb 15, 2019
by
Jacksgong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: update kcptun for auto-restart server
parent
774b3332
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
1 deletion
+43
-1
r7800-ss-kcptun.md
source/_posts/r7800-ss-kcptun.md
+43
-1
No files found.
source/_posts/r7800-ss-kcptun.md
View file @
bccee9d2
title: 网件R7800 SS + ChinaDNS + KcpTun实现YouTuBe 4K流畅体验
date: 2018-11-25 16:44:03
updated: 2019-0
1-23
updated: 2019-0
2-15
categories:
-
网络
tags:
...
...
@@ -272,6 +272,47 @@ chmod +x /bin/update_chinadns.sh

## V. 检测服务存在问题自动重启kcptun
先确保必要的工具
`wget`
已经被安装:
```
opkg update
opkg install wget
```
然后我们新建一个脚本
`/root/test-kcptun`
,然后填入以下内容:
```
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
wget --spider --quiet --tries=1 --timeout=3 www.google.co.jp
if [ "$?" == "0" ]; then
# echo '['$LOGTIME'] No Problem.'
exit 0
else
wget --spider --quiet --tries=1 --timeout=3 www.baidu.com
if [ "$?" == "0" ]; then
echo '['$LOGTIME'] Problem decteted, restarting kcptun.'
/etc/init.d/kcptun restart
else
echo '['$LOGTIME'] Network Problem. Do nothing.'
fi
fi
```
该脚本是测试下google首页访问,如果失败,会再测试下百度首页,如果百度首页也不通说明网络存在问题就不进一步处理,如果百度首页可以通,很大程度上kcptun存在问题,就自动重启kcptun服务。
给到该脚本可执行权限:
```
chmod +x /root/test-kcptun
```
配置每4分钟自动执行下这个文件,并将重启操作写入
`/var/log/kcptun_watchdog.log`
,执行
`crontab -e`
添加以下:
```
4 * * * * /root/test-kcptun >> /var/log/kcptun_watchdog.log 2>&1
```
---
...
...
@@ -279,3 +320,4 @@ chmod +x /bin/update_chinadns.sh
-
[
Shadowsocks + GfwList 实现 OpenWRT / LEDE 路由器自动翻墙
](
https://cokebar.info/archives/962
)
-
[
Openwrt配置Shadowsocks
](
http://notes.guoliangwu.com/2017/04/02/OpenWrt-ShadowSocks-Config/
)
-
[
OpenWrt 路由器安装 KCPTun 客户端
](
https://cyhour.com/479/
)
-
[
转载个SS异常重启脚本
](
https://www.right.com.cn/forum/thread-183686-1-1.html
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment