{"id":260,"date":"2017-10-22T20:48:40","date_gmt":"2017-10-22T11:48:40","guid":{"rendered":"https:\/\/www.ish.org\/blog\/?p=260"},"modified":"2017-10-29T19:52:43","modified_gmt":"2017-10-29T10:52:43","slug":"crontab-for-certbot-renew","status":"publish","type":"post","link":"https:\/\/www.ish.org\/blog\/?p=260","title":{"rendered":"certbot\uff08\u305d\u306e2: crontab\uff09"},"content":{"rendered":"<p>\u4eca\u306e\u6240\u3001Let&#8217;s Encrypt\u3067\u306e\u8a3c\u660e\u66f8\u306f\uff11\u500b\u3060\u3051\u306a\u306e\u3067\u3001\u5b9f\u969b\u306brenew\u3057\u306a\u3044\u9650\u308a\u306f\u30e1\u30fc\u30eb\u3082\u306a\u304f\u3066\u826f\u3044\u306e\u306a\u3089crontab\u306f\u3053\u3093\u306a\u611f\u3058\u3067\u5927\u4e08\u592b\u3002\uff08\u3068\u601d\u3063\u3066\u3044\u305f\u304c\u3001\u6a19\u6e96\u51fa\u529b\u4ee5\u5916\u3078\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u30e1\u30fc\u30eb\u3067\u5c4a\u304d\u307e\u3059\u306d\u3002\uff09<!--more--><code><\/p>\n<p># crontab -l<br \/>\n20 2 * * * \/usr\/local\/bin\/certbot renew --webroot -w \/usr\/local\/www\/apache24\/data\/ | grep '\/usr\/local\/etc\/letsencrypt\/live\/www.ish.org\/fullchain.pem (success)' &amp;&amp; \/usr\/local\/etc\/rc.d\/apache24 reload<br \/>\n<\/code><br \/>\n \u3067\u3082\u3001\u5c06\u6765\u3001\u8907\u6570\u306e\u8a3c\u660e\u66f8\u3092\u6271\u3046\u5834\u5408\u306b\u306f\u3001\u3061\u3083\u3093\u3068\u6bce\u56de\u30e1\u30fc\u30eb\u3082\u51fa\u3059\u3088\u3046\u306b<br \/>\n <code><br \/>\n# crontab -l<br \/>\n20 2 * * * \/root\/bin\/certbot-renew<br \/>\n# cat \/root\/bin\/certbot-renew<br \/>\n\/usr\/local\/bin\/certbot renew --webroot -w \/usr\/local\/www\/apache24\/data\/ \\<br \/>\n\u3000\u3000| tee \/tmp\/certbot.tmp.$$<br \/>\ngrep '\/usr\/local\/etc\/letsencrypt\/live\/www.ish.org\/fullchain.pem (success)' \\<br \/>\n\u3000\u3000\/tmp\/certbot.tmp.$$ &amp;&amp; \/usr\/local\/etc\/rc.d\/apache24 reload<br \/>\ngrep '\/usr\/local\/etc\/letsencrypt\/live\/mail.ish.org\/fullchain.pem (success)' \\<br \/>\n\u3000\u3000\/tmp\/certbot.tmp.$$ \\<br \/>\n\u3000\u3000&amp;&amp; chmod 400 \/usr\/local\/etc\/letsencrypt\/live\/mail.ish.org\/privkey.pem \\<br \/>\n\u3000\u3000&amp;&amp; \/etc\/rc.d\/sendmail restart &amp;&amp; \/usr\/local\/etc\/rc.d\/dovecot reload<br \/>\nrm \/tmp\/certbot.tmp.$$<br \/>\n<\/code><br \/>\n \u3063\u3066\u3044\u3046\u611f\u3058\u306b\u306a\u308b\u304b\u306a\u3041\u3002(sendmail\u306fprivate key\u306eread\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3\u304cgroup\/other\u306b\u3042\u308b\u3068\u52d5\u304b\u306a\u3044\u306e\u3067chmod\u3067\u76f4\u3057\u3066\u3044\u307e\u3059\u3002)<\/p>\n<p><a href=\/blog\/?p=249>\u305d\u306e1<\/a>\u3078\u623b\u308b\u3000\u3000<a href=\"\/blog\/?p=267\">\u305d\u306e3<\/a>\u3078\u7d9a\u304f<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u306e\u6240\u3001Let&#8217;s Encrypt\u3067\u306e\u8a3c\u660e\u66f8\u306f\uff11\u500b\u3060\u3051\u306a\u306e\u3067\u3001\u5b9f\u969b\u306brenew\u3057\u306a\u3044\u9650\u308a\u306f\u30e1\u30fc\u30eb\u3082\u306a\u304f\u3066\u826f\u3044\u306e\u306a\u3089crontab\u306f\u3053\u3093\u306a\u611f\u3058\u3067\u5927\u4e08\u592b\u3002\uff08\u3068\u601d\u3063\u3066\u3044\u305f\u304c\u3001\u6a19\u6e96\u51fa\u529b\u4ee5\u5916\u3078\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u30e1\u30fc\u30eb\u3067\u5c4a\u304d &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.ish.org\/blog\/?p=260\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;certbot\uff08\u305d\u306e2: crontab\uff09&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,9],"tags":[],"class_list":["post-260","post","type-post","status-publish","format-standard","hentry","category-freebsd","category-misc"],"_links":{"self":[{"href":"https:\/\/www.ish.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/260","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ish.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ish.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ish.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ish.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=260"}],"version-history":[{"count":7,"href":"https:\/\/www.ish.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/260\/revisions"}],"predecessor-version":[{"id":331,"href":"https:\/\/www.ish.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/260\/revisions\/331"}],"wp:attachment":[{"href":"https:\/\/www.ish.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=260"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ish.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=260"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ish.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=260"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}