{"id":386,"date":"2019-10-15T23:15:37","date_gmt":"2019-10-15T20:15:37","guid":{"rendered":"http:\/\/guwi.ru\/?p=386"},"modified":"2019-10-15T23:15:37","modified_gmt":"2019-10-15T20:15:37","slug":"%d0%bc%d0%be%d0%bd%d0%b8%d1%82%d0%be%d1%80%d0%b8%d0%bd%d0%b3-%d1%81%d0%b0%d0%b9%d1%82%d0%be%d0%b2-%d0%bd%d0%b0-%d0%ba%d0%be%d0%bb%d0%b5%d0%bd%d0%ba%d0%b5-bash-script","status":"publish","type":"post","link":"http:\/\/guwi.ru\/?p=386","title":{"rendered":"\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0441\u0430\u0439\u0442\u043e\u0432 \u043d\u0430 \u043a\u043e\u043b\u0435\u043d\u043a\u0435 (bash script)"},"content":{"rendered":"<pre>#\/bin\/bash\nhtml=\/var\/www\/servers_state.html\nwhile true; do\n\techo \"<br><br><br>\" > $html\n\techo '<center><table width=\"40%\" border=\"1\" cellspacing=\"0\" cellpadding=\"5\" >' >> $html\n\techo \"<tr><td><\/td><td><b>HOST<\/b><\/td><td><b>State<\/b><\/td><\/tr>\" >> $html\n\ti=1\n\tserverlist=(website1.com website2.com website3.com website4.com website4.com)\n\tfor web in \"${serverlist[@]}\";do\n\t\tstate=$(HEAD -t 8 $web |sed -n 1p)\n\t\techo \"<tr><td>$i<\/td><td>$ip<\/td><td>$state<\/td><\/tr>\" >> $html\n\t\tif [ \"$state\" != \"200 OK\" ]\n\t\tthen\n\t\t\t\t\t\techo \"Something is wrong with $ip\" |mail -s \"Invalid responce from $web\" \\ yourmail@domain.com\n\t\tfi\n\tlet \"i = $i +1\"\ndone\necho \"<\/table>\" >> $html\necho \"<br>\" >> $html\necho \"<p>Last updated at $(date +%H:%M:%S)<\/p>\" >> $html\necho \"<\/center>\" >> $html\nsleep 30\ndone<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>#\/bin\/bash html=\/var\/www\/servers_state.html while true; do echo &#8220;&#8221; > $html echo &#8221; >> $html echo &#8220;HOSTState&#8221; >> $html i=1 serverlist=(website1.com website2.com website3.com website4.com website4.com) for web in &#8220;${serverlist[@]}&#8221;;do state=$(HEAD -t 8 $web |sed -n 1p) echo &#8220;$i$ip$state&#8221; >> $html if [ &#8220;$state&#8221; != &#8220;200 OK&#8221; ] then echo &#8220;Something is wrong with $ip&#8221; |mail -s &#8220;Invalid\u2026 <span class=\"read-more\"><a href=\"http:\/\/guwi.ru\/?p=386\">\u0427\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043b\u0435\u0435 &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-386","post","type-post","status-publish","format-standard","hentry","category-5"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\r\n<title>\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0441\u0430\u0439\u0442\u043e\u0432 \u043d\u0430 \u043a\u043e\u043b\u0435\u043d\u043a\u0435 (bash script) - \u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043f\u043e\u0440\u0442\u0430\u043b GUWi.ru<\/title>\r\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\r\n<link rel=\"canonical\" href=\"http:\/\/guwi.ru\/?p=386\" \/>\r\n<meta property=\"og:locale\" content=\"ru_RU\" \/>\r\n<meta property=\"og:type\" content=\"article\" \/>\r\n<meta property=\"og:title\" content=\"\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0441\u0430\u0439\u0442\u043e\u0432 \u043d\u0430 \u043a\u043e\u043b\u0435\u043d\u043a\u0435 (bash script) - \u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043f\u043e\u0440\u0442\u0430\u043b GUWi.ru\" \/>\r\n<meta property=\"og:description\" content=\"#\/bin\/bash html=\/var\/www\/servers_state.html while true; do echo &quot;&quot; &gt; $html echo &#039;&#039; &gt;&gt; $html echo &quot;HOSTState&quot; &gt;&gt; $html i=1 serverlist=(website1.com website2.com website3.com website4.com website4.com) for web in &quot;${serverlist[@]}&quot;;do state=$(HEAD -t 8 $web |sed -n 1p) echo &quot;$i$ip$state&quot; &gt;&gt; $html if [ &quot;$state&quot; != &quot;200 OK&quot; ] then echo &quot;Something is wrong with $ip&quot; |mail -s &quot;Invalid\u2026 \u0427\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043b\u0435\u0435 &raquo;\" \/>\r\n<meta property=\"og:url\" content=\"http:\/\/guwi.ru\/?p=386\" \/>\r\n<meta property=\"og:site_name\" content=\"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043f\u043e\u0440\u0442\u0430\u043b GUWi.ru\" \/>\r\n<meta property=\"article:published_time\" content=\"2019-10-15T20:15:37+00:00\" \/>\r\n<meta name=\"author\" content=\"admin\" \/>\r\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\r\n<meta name=\"twitter:label1\" content=\"\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0430\u0432\u0442\u043e\u0440\u043e\u043c\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\r\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"http:\/\/guwi.ru\/?p=386\",\"url\":\"http:\/\/guwi.ru\/?p=386\",\"name\":\"\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0441\u0430\u0439\u0442\u043e\u0432 \u043d\u0430 \u043a\u043e\u043b\u0435\u043d\u043a\u0435 (bash script) - \u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043f\u043e\u0440\u0442\u0430\u043b GUWi.ru\",\"isPartOf\":{\"@id\":\"http:\/\/guwi.ru\/#website\"},\"datePublished\":\"2019-10-15T20:15:37+00:00\",\"dateModified\":\"2019-10-15T20:15:37+00:00\",\"author\":{\"@id\":\"http:\/\/guwi.ru\/#\/schema\/person\/8389c039a09ca9a7a03b90d05f430762\"},\"breadcrumb\":{\"@id\":\"http:\/\/guwi.ru\/?p=386#breadcrumb\"},\"inLanguage\":\"ru-RU\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/guwi.ru\/?p=386\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/guwi.ru\/?p=386#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\",\"item\":\"http:\/\/guwi.ru\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0441\u0430\u0439\u0442\u043e\u0432 \u043d\u0430 \u043a\u043e\u043b\u0435\u043d\u043a\u0435 (bash script)\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/guwi.ru\/#website\",\"url\":\"http:\/\/guwi.ru\/\",\"name\":\"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043f\u043e\u0440\u0442\u0430\u043b GUWi.ru\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/guwi.ru\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"ru-RU\"},{\"@type\":\"Person\",\"@id\":\"http:\/\/guwi.ru\/#\/schema\/person\/8389c039a09ca9a7a03b90d05f430762\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ru-RU\",\"@id\":\"http:\/\/guwi.ru\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/119031a5dc09b470495f25546952bbd6788e8c489add738a2afe18ab63de8267?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/119031a5dc09b470495f25546952bbd6788e8c489add738a2afe18ab63de8267?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/guwi.ru\"],\"url\":\"http:\/\/guwi.ru\/?author=1\"}]}<\/script>\r\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0441\u0430\u0439\u0442\u043e\u0432 \u043d\u0430 \u043a\u043e\u043b\u0435\u043d\u043a\u0435 (bash script) - \u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043f\u043e\u0440\u0442\u0430\u043b GUWi.ru","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/guwi.ru\/?p=386","og_locale":"ru_RU","og_type":"article","og_title":"\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0441\u0430\u0439\u0442\u043e\u0432 \u043d\u0430 \u043a\u043e\u043b\u0435\u043d\u043a\u0435 (bash script) - \u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043f\u043e\u0440\u0442\u0430\u043b GUWi.ru","og_description":"#\/bin\/bash html=\/var\/www\/servers_state.html while true; do echo \"\" > $html echo '' >> $html echo \"HOSTState\" >> $html i=1 serverlist=(website1.com website2.com website3.com website4.com website4.com) for web in \"${serverlist[@]}\";do state=$(HEAD -t 8 $web |sed -n 1p) echo \"$i$ip$state\" >> $html if [ \"$state\" != \"200 OK\" ] then echo \"Something is wrong with $ip\" |mail -s \"Invalid\u2026 \u0427\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043b\u0435\u0435 &raquo;","og_url":"http:\/\/guwi.ru\/?p=386","og_site_name":"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043f\u043e\u0440\u0442\u0430\u043b GUWi.ru","article_published_time":"2019-10-15T20:15:37+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0430\u0432\u0442\u043e\u0440\u043e\u043c":"admin"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"http:\/\/guwi.ru\/?p=386","url":"http:\/\/guwi.ru\/?p=386","name":"\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0441\u0430\u0439\u0442\u043e\u0432 \u043d\u0430 \u043a\u043e\u043b\u0435\u043d\u043a\u0435 (bash script) - \u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043f\u043e\u0440\u0442\u0430\u043b GUWi.ru","isPartOf":{"@id":"http:\/\/guwi.ru\/#website"},"datePublished":"2019-10-15T20:15:37+00:00","dateModified":"2019-10-15T20:15:37+00:00","author":{"@id":"http:\/\/guwi.ru\/#\/schema\/person\/8389c039a09ca9a7a03b90d05f430762"},"breadcrumb":{"@id":"http:\/\/guwi.ru\/?p=386#breadcrumb"},"inLanguage":"ru-RU","potentialAction":[{"@type":"ReadAction","target":["http:\/\/guwi.ru\/?p=386"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/guwi.ru\/?p=386#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430","item":"http:\/\/guwi.ru\/"},{"@type":"ListItem","position":2,"name":"\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0441\u0430\u0439\u0442\u043e\u0432 \u043d\u0430 \u043a\u043e\u043b\u0435\u043d\u043a\u0435 (bash script)"}]},{"@type":"WebSite","@id":"http:\/\/guwi.ru\/#website","url":"http:\/\/guwi.ru\/","name":"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043f\u043e\u0440\u0442\u0430\u043b GUWi.ru","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/guwi.ru\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"ru-RU"},{"@type":"Person","@id":"http:\/\/guwi.ru\/#\/schema\/person\/8389c039a09ca9a7a03b90d05f430762","name":"admin","image":{"@type":"ImageObject","inLanguage":"ru-RU","@id":"http:\/\/guwi.ru\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/119031a5dc09b470495f25546952bbd6788e8c489add738a2afe18ab63de8267?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/119031a5dc09b470495f25546952bbd6788e8c489add738a2afe18ab63de8267?s=96&d=mm&r=g","caption":"admin"},"sameAs":["http:\/\/guwi.ru"],"url":"http:\/\/guwi.ru\/?author=1"}]}},"_links":{"self":[{"href":"http:\/\/guwi.ru\/index.php?rest_route=\/wp\/v2\/posts\/386","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/guwi.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/guwi.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/guwi.ru\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/guwi.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=386"}],"version-history":[{"count":0,"href":"http:\/\/guwi.ru\/index.php?rest_route=\/wp\/v2\/posts\/386\/revisions"}],"wp:attachment":[{"href":"http:\/\/guwi.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=386"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/guwi.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=386"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/guwi.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=386"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}