{"id":4108,"date":"2012-11-03T00:15:30","date_gmt":"2012-11-02T16:15:30","guid":{"rendered":"http:\/\/jpuyy.com\/?p=4108"},"modified":"2013-03-03T11:24:55","modified_gmt":"2013-03-03T03:24:55","slug":"update-oray-ip","status":"publish","type":"post","link":"https:\/\/jpuyy.com\/?p=4108","title":{"rendered":"\u81ea\u52a8\u66f4\u65b0\u82b1\u751f\u58f3\u7684ip"},"content":{"rendered":"<p>\u53c2\u8003\uff1a<\/p>\n<p><a href=\"http:\/\/open.oray.com\/wiki\/doku.php?id=%E6%96%87%E6%A1%A3:%E8%8A%B1%E7%94%9F%E5%A3%B3:http%E5%8D%8F%E8%AE%AE%E8%AF%B4%E6%98%8E\" target=\"_blank\">http:\/\/open.oray.com\/wiki\/doku.php?id=\u6587\u6863:\u82b1\u751f\u58f3:http\u534f\u8bae\u8bf4\u660e<\/a><\/p>\n<p>\u53ea\u80fd\u4f7f\u7528GET\u65b9\u5f0f\u63d0\u4ea4\u4fe1\u606f\uff0c\u8fd9\u91cc\u4f7f\u7528curl\uff0c\u9700\u63d0\u524d\u5b89\u88c5\u597dcurl\u3002<br \/>\n\u52a0\u4e00\u4e2a\u5224\u65ad\uff0c\u5982\u679c\u5f53\u524ddns\u4e2d\u7684ip\u548c\u68c0\u6d4b\u7684ip\u4e0d\u4e00\u81f4\u65f6\uff0c\u5c31\u81ea\u52a8\u63d0\u4ea4\uff1b\u4e00\u81f4\u5219\u9000\u51fa\u3002<\/p>\n<pre>#!\/bin\/bash\r\norayuser=your oray name\r\noraypass=your oray passoword\r\noraydomain=your domain\r\nrealip=`curl http:\/\/ddns.oray.com\/checkip | cut -d' ' -f 6 | cut -d'&lt;' -f 1`\r\ntheurl=\"http:\/\/$orayuser:$oraypass@ddns.oray.com\/ph\/update?hostname=$oraydomain&amp;myip=$realip\"\r\ncurrentip=`nslookup $oraydomain | tail -2 | head -1 | cut -d' ' -f 2`\r\nif [ \"$realip\" = \"$currentip\" ]; then\r\n exit 0\r\nelse\r\n curl \"$theurl\"\r\nfi<\/pre>\n<p>\u5728crontab\u4e2d\u52a0\u5165\u4ee5\u4e0b\u5185\u5bb9\uff0c\u6bcf\u5341\u4e94\u5206\u949f\u68c0\u6d4b\u4e00\u6b21<\/p>\n<pre>*\/15 * * * * \/bin\/bash \/root\/pushiporay.sh<\/pre>\n<p>&#8211;\u6dfb\u52a0\u4e8e2013\u5e743\u67083\u65e5\u5f00\u59cb&#8211;<\/p>\n<p>\u540e\u6765\u7533\u8bf7\u4e86noip.com\u7684\u4e8c\u7ea7\u57df\u540d\uff0c\u624d\u53d1\u73b0\u82b1\u751f\u58f3\u548c\u4eba\u5bb6\u7684api\u662f\u5982\u6b64\u7684\u50cf\u3002\u540c\u7406\u53ef\u66f4\u65b0noip\u91cc\u7684\u8bb0\u5f55<\/p>\n<pre>#!\/bin\/bash\r\nnoipuser=your noip username\r\nnoippass=your noip password\r\nnoipdomain=your noip domain\r\nrealip=`curl http:\/\/ddns.oray.com\/checkip | cut -d' ' -f 6 | cut -d'&lt;' -f 1`\r\nnoipurl=\"http:\/\/$noipuser:$noippass@dynupdate.no-ip.com\/nic\/update?hostname=$noipdomain&amp;myip=$realip\"\r\nnoipcurrentip=`nslookup $noipdomain | tail -2 | head -1 | cut -d' ' -f 2`\r\nif [ \"$realip\" = \"$noipcurrentip\" ]; then\r\n echo \"no need to update\"\r\n exit 0\r\nelse\r\n curl \"$noipurl\"\r\nfi<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u53c2\u8003\uff1a http:\/\/open.oray.com\/wiki\/doku.php?id=\u6587\u6863:\u82b1\u751f\u58f3:http\u534f\u8bae\u8bf4\u660e \u53ea\u80fd\u4f7f\u7528GET\u65b9\u5f0f\u63d0\u4ea4\u4fe1\u606f\uff0c\u8fd9\u91cc\u4f7f\u7528curl\uff0c\u9700\u63d0\u524d\u5b89\u88c5\u597dcurl\u3002 \u52a0\u4e00\u4e2a\u5224\u65ad\uff0c\u5982\u679c\u5f53\u524ddns\u4e2d\u7684ip\u548c\u68c0\u6d4b\u7684ip\u4e0d\u4e00\u81f4\u65f6\uff0c\u5c31\u81ea\u52a8\u63d0\u4ea4\uff1b\u4e00\u81f4\u5219\u9000\u51fa\u3002 #!\/bin\/bash orayuser=your oray name oraypass=your oray passoword oraydomain=your domain realip=`curl http:\/\/ddns.oray.com\/checkip | cut -d&#8217; &#8216; -f 6 | cut -d'&lt;&#8216; -f 1` theurl=&#8221;http:\/\/$orayuser:$oraypass@ddns.oray.com\/ph\/update?hostname=$oraydomain&amp;myip=$realip&#8221; currentip=`nslookup $oraydomain | tail -2 | head -1 | cut -d&#8217; &#8216; -f 2` if [ &#8220;$realip&#8221; = &#8220;$currentip&#8221; ]; then exit 0 else curl &#8220;$theurl&#8221; fi \u5728crontab\u4e2d\u52a0\u5165\u4ee5\u4e0b\u5185\u5bb9\uff0c\u6bcf\u5341\u4e94\u5206\u949f\u68c0\u6d4b\u4e00\u6b21 [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[112,23],"class_list":["post-4108","post","type-post","status-publish","format-standard","hentry","category-linux","tag-curl","tag-summary"],"_links":{"self":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/4108","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4108"}],"version-history":[{"count":12,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/4108\/revisions"}],"predecessor-version":[{"id":4115,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/4108\/revisions\/4115"}],"wp:attachment":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}