小米路由mini的一些脚本
Submitted by ╰☆往事如风 on 2014, December 8, 4:07 PM. 编程技术
先记录下,目前已能正常自动更新。
后续再整理汇总。
run.sh
#!/bin/sh
cd `df -h |grep extdisks|awk -F ' ' '{print $6}'`/smartvpn/
rm -rf `df -h |grep extdisks|awk -F ' ' '{print $6}'`/smartvpn/ip-pre-up `df -h |grep extdisks|awk -F ' ' '{print $6}'`/smartvpn/ip-down `df -h |grep extdisks|awk -F ' ' '{print $6}'`/smartvpn/dnsmasq.d/ `df -h |grep extdisks|awk -F ' ' '{print $6}'`/smartvpn/status-check.sh `df -h |grep extdisks|awk -F ' ' '{print $6}'`/smartvpn/ip.tar
wget http://xxx.xxx.xxx/ixx.tar
tar -xvf ixx.tar
if grep -q "/etc/ppp/ppp.d/vpn_custom_route\" /etc/ppp/ppp.d/vpn-up ; then echo \"Already modify vpn-up script for vpn_custom_route add\";else echo \"/etc/ppp/ppp.d/vpn_custom_route\">>/etc/ppp/ppp.d/vpn-up;echo \"add vpn_custom_route into vpn-up script\"; fi
if [ ! -x \"/etc/ppp/ppp.d/vpn_custom_route\" ]; then ln -sf `df -h |grep extdisks|awk -F ' ' '{print $6}'`/smartvpn/ip-pre-up /etc/ppp/ppp.d/vpn_custom_route; else echo \"/etc/ppp/ppp.d/vpn_custom_route already link\" ; fi
if [ ! -d \"/etc/ppp/ip-down.d\" ]; then mkdir /etc/ppp/ip-down.d; fi
if [ ! -x \"/etc/ppp/ip-down.d/vpn-down\" ]; then ln -sf `df -h |grep extdisks|awk -F ' ' '{print $6}'`/smartvpn/ip-down /etc/ppp/ip-down.d/vpn-down; chmod +x /etc/ppp/ip-down.d/vpn-down;fi
ln -sf `df -h |grep extdisks|awk -F ' ' '{print $6}'`/smartvpn/dnsmasq.d/dnsmasq.custom.conf /etc/dnsmasq.d/dnsmasq.custom.conf
ifdown vpn
ifup vpn
/etc/init.d/dnsmasq restart
if grep \"smartvpn/run.sh\" /etc/crontabs/root; then echo \"already have init run script in crontab\"; else echo \"0 5 * * * \`df -h |grep extdisks|awk -F ' ' '{print \$6}'\`/smartvpn/run.sh >> /tmp/smartvpn.log 2>&1\" >> /etc/crontabs/root;/etc/init.d/cron restart; fi
if grep \"smartvpn/status-check.sh\" /etc/crontabs/root; then echo \"already have init run script in crontab\"; else echo \"*/1 * * * * \`df -h |grep extdisks|awk -F ' ' '{print \$6}'\`/smartvpn/status-check.sh >> /tmp/smartvpn.log 2>&1\" >> /etc/crontabs/root;/etc/init.d/cron restart; fi
« 上一篇 | 下一篇 »
发表评论