{"id":4856,"date":"2014-08-14T14:28:47","date_gmt":"2014-08-14T20:28:47","guid":{"rendered":"http:\/\/gregsowell.com\/?p=4856"},"modified":"2014-08-14T14:28:47","modified_gmt":"2014-08-14T20:28:47","slug":"linux-script-to-test-secure-pop3","status":"publish","type":"post","link":"https:\/\/gregsowell.com\/?p=4856","title":{"rendered":"Linux Script To Test Secure POP3"},"content":{"rendered":"<p>I placed the script int he root folder as \/root\/poptest.sh.<\/p>\n<pre class=\"gs-code\"><code class=\"language-plaintext\">#!\/bin\/bash\r\n\r\necho &quot;x&quot; | openssl s_client -connect 127.0.0.1:995 &gt; \/root\/pop3test.txt\r\n\r\nif grep -Fq &quot;POP3 server ready&quot; \/root\/pop3test.txt\r\nthen\r\n    # code if found\r\n    echo &quot;found&quot;\r\nelse\r\n    # code if not found\r\n    echo &quot;not found&quot;\r\n    service zimbra restart\r\nfi<\/code><\/pre>\n<p>I then created a cron job that runs every 15 minutes and calls the script.<\/p>\n<p>It uses the openssl client to connect to the server.  It then pipes this to a file named pop3test.txt.  After this it checks the file for &#8220;POP3 server ready&#8221; which is the all clear message at the end of the file.<\/p>\n<p>If it passes it does nothing.  If it fails it restarts the zimbra service(this happens to be running on a zimbra server).<\/p>\n<p>Good luck and happy popping.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I placed the script int he root folder as \/root\/poptest.sh. #!\/bin\/bash echo &quot;x&quot; | openssl s_client -connect 127.0.0.1:995 &gt; \/root\/pop3test.txt if grep -Fq &quot;POP3\u2026<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14,13],"tags":[],"class_list":["post-4856","post","type-post","status-publish","format-standard","hentry","category-linux","category-server"],"_links":{"self":[{"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/posts\/4856","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/gregsowell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4856"}],"version-history":[{"count":1,"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/posts\/4856\/revisions"}],"predecessor-version":[{"id":4857,"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/posts\/4856\/revisions\/4857"}],"wp:attachment":[{"href":"https:\/\/gregsowell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4856"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gregsowell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4856"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gregsowell.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4856"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}