经过web方式更新花生壳地址
通过web方式更新花生壳地址
linux的花生壳客户端经常不能更新地址,作为补充,设置一个web更新任务。
1.创建python脚本
2.设置定时任务
1.创建python脚本
import re import os os.system('rm update*') os.system('pkill -9 wget') os.system('rm checkip') os.system('wget http://ddns.oray.com/checkip') input=open('checkip') c=input.read() m=re.match(r'.*Address: (.*)</body>.*',c) ip=m.group(1) p=ip.index('.') update=r"http://用户名:密码@ddns.oray.com/ph/update?hostname=域名&myip="+ip os.system('wget '+update)
2.设置定时任务
crontab -e 输入: 0,5,10,15,20,25,30,35,40,45,50,55 * * * * /home/root/ip.py