{"id":1656,"date":"2017-09-09T14:44:34","date_gmt":"2017-09-09T05:44:34","guid":{"rendered":"http:\/\/matoken.org\/blog\/?p=1656"},"modified":"2017-09-09T14:44:34","modified_gmt":"2017-09-09T05:44:34","slug":"wget-retry-option","status":"publish","type":"post","link":"https:\/\/matoken.org\/blog\/2017\/09\/09\/wget-retry-option\/","title":{"rendered":"wget\u306e\u518d\u8a66\u884c\u30aa\u30d7\u30b7\u30e7\u30f3"},"content":{"rendered":"<p>\u697d\u3057\u307f\u306b\u3057\u3066\u3044\u305fRaspbian\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u304c\u6b62\u307e\u3063\u3066\u307e\u3057\u305f\uff0e<br \/>\n\u505c\u96fb\u3084\u30eb\u30fc\u30bf\u30fc\u4e0d\u8abf\u3068\u304b\u3067\u56de\u7dda\u30a4\u30de\u30a4\u30c1\u306a\u306e\u3067\u3059\uff0e<\/p>\n<p>\u306a\u306e\u3067<code>wgetc<\/code>\u3068\u304b\u9069\u5f53\u306ascript\u3092\u7528\u610f\u3057\u3066<\/p>\n<table  class=\"codehilitetable table table-hover\" >\n<tr>\n<td class=\"linenos\">\n<div class=\"linenodiv\">\n<pre> 1\n 2\n 3\n 4\n 5\n 6\n 7\n 8\n 9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20<\/pre>\n<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"codehilite\">\n<pre><span><\/span><span class=\"ch\">#!\/bin\/sh<\/span>\n\n<span class=\"k\">if<\/span> <span class=\"o\">[<\/span> <span class=\"nv\">$#<\/span> -eq <span class=\"m\">0<\/span> <span class=\"o\">]<\/span><span class=\"p\">;<\/span> <span class=\"k\">then<\/span>\n  <span class=\"nb\">echo<\/span> <span class=\"s2\">&quot;<\/span><span class=\"nv\">$0<\/span><span class=\"s2\"> URL&quot;<\/span> <span class=\"m\">1<\/span>&gt;<span class=\"p\">&amp;<\/span><span class=\"m\">2<\/span>\n  <span class=\"nb\">exit<\/span> <span class=\"m\">1<\/span>\n<span class=\"k\">fi<\/span>\n\n<span class=\"k\">while<\/span> :\n<span class=\"k\">do<\/span>\n\nwget -c <span class=\"nv\">$1<\/span>\n\n<span class=\"k\">if<\/span> <span class=\"o\">[<\/span> <span class=\"s2\">&quot;<\/span><span class=\"nv\">$?<\/span><span class=\"s2\">&quot;<\/span> -eq <span class=\"m\">0<\/span> <span class=\"o\">]<\/span><span class=\"p\">;<\/span> <span class=\"k\">then<\/span>\n  <span class=\"nb\">echo<\/span> <span class=\"s2\">&quot;Done!&quot;<\/span> <span class=\"m\">1<\/span>&gt;<span class=\"p\">&amp;<\/span><span class=\"m\">2<\/span>\n  <span class=\"nb\">exit<\/span> <span class=\"m\">0<\/span><span class=\"p\">;<\/span>\n<span class=\"k\">fi<\/span>\n\nsleep <span class=\"m\">1<\/span>\n\n<span class=\"k\">done<\/span>\n<\/pre>\n<\/div>\n<\/td>\n<\/tr>\n<\/table>\n<p>chmod +x \u3057\u3066\u3053\u3093\u306a\u611f\u3058\u3067\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9<\/p>\n<div class=\"codehilite\">\n<pre><span><\/span>$ wgetc http:\/\/vx2-downloads.raspberrypi.org\/raspbian\/images\/raspbian-2017-09-08\/2017-09-07-raspbian-stretch.zip <span class=\"p\">;<\/span> wgetc http:\/\/vx2-downloads.raspberrypi.org\/raspbian_lite\/images\/raspbian_lite-2017-09-08\/2017-09-07-raspbian-stretch-lite.zip <span class=\"p\">;<\/span> sha256sum raspbian*.zip\n<\/pre>\n<\/div>\n<p>3\u56de\u307b\u3069\u306e\u8a66\u884c\u3067\u3069\u3046\u306b\u304b\u7d42\u308f\u3063\u3066\u307e\u3057\u305f\uff0e<\/p>\n<p>\u305d\u3057\u3066\u8fd4\u308a\u5024\u3061\u3083\u3093\u3068\u78ba\u8a8d\u3059\u308b\u304b\u3068wget\u306eman\u3092\u898b\u305f\u3089\u2026\u2026\uff0e<\/p>\n<div class=\"codehilite\">\n<pre><span><\/span>       --retry-connrefused\n           Consider &quot;connection refused&quot; a transient error and try again.  Normally Wget gives up on a URL when it is unable to connect to the site\n           because failure to connect is taken as a sign that the server is not running at all and that retries would not help.  This option is for\n           mirroring unreliable sites whose servers tend to disappear for short periods of time.\n<\/pre>\n<\/div>\n<div class=\"codehilite\">\n<pre><span><\/span>       --waitretry=seconds\n           If you don&#039;t want Wget to wait between every retrieval, but only between retries of failed downloads, you can use this option.  Wget will use\n           linear backoff, waiting 1 second after the first failure on a given file, then waiting 2 seconds after the second failure on that file, up to\n           the maximum number of seconds you specify.\n\n           By default, Wget will assume a value of 10 seconds.\n<\/pre>\n<\/div>\n<p>\u5b9f\u88c5\u3055\u308c\u3066\u307e\u3057\u305forz<\/p>\n<div class=\"codehilite\">\n<pre><span><\/span>$ wget -c --retry-connrefused <span class=\"o\">[<\/span>URL<span class=\"o\">]<\/span>\n<\/pre>\n<\/div>\n<p>\u306a\u611f\u3058\u3067\u826f\u3055\u305d\u3046\uff0e<br \/>\n\u6b21\u306e\u6a5f\u4f1a\u306b\u8a66\u3057\u3066\u307f\u307e\u3059\uff0e<\/p>\n<div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u697d\u3057\u307f\u306b\u3057\u3066\u3044\u305fRaspbian\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u304c\u6b62\u307e\u3063\u3066\u307e\u3057\u305f\uff0e \u505c\u96fb\u3084\u30eb\u30fc\u30bf\u30fc\u4e0d\u8abf\u3068\u304b\u3067\u56de\u7dda\u30a4\u30de\u30a4\u30c1\u306a\u306e\u3067\u3059\uff0e \u306a\u306e\u3067wgetc\u3068\u304b\u9069\u5f53\u306ascript\u3092\u7528\u610f\u3057\u3066 1 2 3 4 5 6 7 8 9 10 11 12 1 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"webmentions_disabled_pings":false,"webmentions_disabled":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[6],"tags":[256],"class_list":["post-1656","post","type-post","status-publish","format-standard","hentry","category-linux","tag-wget"],"_links":{"self":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts\/1656","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/comments?post=1656"}],"version-history":[{"count":0,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts\/1656\/revisions"}],"wp:attachment":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/media?parent=1656"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/categories?post=1656"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/tags?post=1656"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}