Think before you speak, read before you think.

Tag: curl

  • 自动更新花生壳的ip

    by

    in

    参考: http://open.oray.com/wiki/doku.php?id=文档:花生壳:http协议说明 只能使用GET方式提交信息,这里使用curl,需提前安装好curl。 加一个判断,如果当前dns中的ip和检测的ip不一致时,就自动提交;一致则退出。 #!/bin/bash orayuser=your oray name oraypass=your oray passoword oraydomain=your domain realip=`curl http://ddns.oray.com/checkip | cut -d’ ‘ -f 6 | cut -d'<‘ -f 1` theurl=”http://$orayuser:$oraypass@ddns.oray.com/ph/update?hostname=$oraydomain&myip=$realip” currentip=`nslookup $oraydomain | tail -2 | head -1 | cut -d’ ‘ -f 2` if [ “$realip” = “$currentip” ]; then exit 0 else curl “$theurl” fi 在crontab中加入以下内容,每十五分钟检测一次…