Last active
March 15, 2018 03:35
-
-
Save haiyon/67e3e024843324f102a53cb8008e88a4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| opkg update | |
| for ipk in $(opkg list-upgradable | awk '$1!~/^kmod|^Multiple/{print $1}'); do | |
| opkg upgrade $ipk | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| LOGTIME=$(date "+%Y-%m-%d %H:%M:%S") | |
| wget --spider --quiet --tries=1 --timeout=10 www.google.com | |
| if [ "$?" == "0" ]; then | |
| echo '['$LOGTIME'] No Problem.' | |
| exit 0 | |
| else | |
| wget --spider --quiet --tries=1 --timeout=10 www.baidu.com | |
| if [ "$?" == "0" ]; then | |
| echo '['$LOGTIME'] Problem decteted, restarting shadowsocks.' | |
| /etc/init.d/shadowsocks restart | |
| else | |
| echo '['$LOGTIME'] Network Problem. restarting chinadns.' | |
| /etc/init.d/chinadns restart | |
| fi | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| set -e -o pipefail | |
| wget -O- 'http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest' | \ | |
| awk -F\| '/CN\|ipv4/ { printf("%s/%d\n", $4, 32-log($5)/log(2)) }' > \ | |
| /tmp/chinadns_chnroute.txt | |
| mv /tmp/chinadns_chnroute.txt /etc/ | |
| if pidof ss-redir>/dev/null; then | |
| /etc/init.d/shadowsocks restart | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment