{"id":6129,"date":"2016-11-20T16:44:28","date_gmt":"2016-11-20T08:44:28","guid":{"rendered":"https:\/\/kyle.ai\/blog\/?p=6129"},"modified":"2016-11-20T16:46:40","modified_gmt":"2016-11-20T08:46:40","slug":"%e5%9c%a8mac%e4%b8%ad%e8%ae%be%e7%bd%aesupervisord%e5%bc%80%e6%9c%ba%e8%87%aa%e5%90%af%e5%8a%a8","status":"publish","type":"post","link":"https:\/\/kyle.ai\/blog\/6129.html","title":{"rendered":"\u5728Mac\u4e2d\u8bbe\u7f6eSupervisord\u5f00\u673a\u81ea\u542f\u52a8"},"content":{"rendered":"<p>\u8bbe\u7f6e supervisord \u4e3a\u7cfb\u7edf\u81ea\u542f\u52a8\u3002<\/p>\n<p>\u6dfb\u52a0 plist \u542f\u52a8\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<p>cat \/Users\/kyle\/etc\/launchctl\/com.agendaless.supervisord.plist<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\r\n&lt;!DOCTYPE plist PUBLIC &quot;-\/\/Apple\/\/DTD PLIST 1.0\/\/EN&quot; &quot;http:\/\/www.apple.com\/DTDs\/PropertyList-1.0.dtd&quot;&gt;\r\n&lt;plist version=&quot;1.0&quot;&gt;\r\n&lt;dict&gt;\r\n    &lt;key&gt;KeepAlive&lt;\/key&gt;\r\n    &lt;dict&gt;\r\n        &lt;key&gt;SuccessfulExit&lt;\/key&gt;\r\n        &lt;false\/&gt;\r\n    &lt;\/dict&gt;\r\n    &lt;key&gt;Label&lt;\/key&gt;\r\n    &lt;string&gt;com.agendaless.supervisord&lt;\/string&gt;\r\n    &lt;key&gt;ProgramArguments&lt;\/key&gt;\r\n    &lt;array&gt;\r\n        &lt;string&gt;\/Users\/kyle\/pyenv\/bin\/supervisord&lt;\/string&gt;\r\n        &lt;string&gt;-n&lt;\/string&gt;\r\n        &lt;string&gt;-c&lt;\/string&gt;\r\n        &lt;string&gt;\/Users\/kyle\/etc\/supervisord.conf&lt;\/string&gt;\r\n    &lt;\/array&gt;\r\n    &lt;key&gt;RunAtLoad&lt;\/key&gt;\r\n    &lt;true\/&gt;\r\n&lt;\/dict&gt;\r\n&lt;\/plist&gt;\r\n<\/pre>\n<p>\u7136\u540e\u52a0\u5165\u5230\u7cfb\u7edf\u7684\u914d\u7f6e\u4e2d\u53bb\uff1a\/Library\/LaunchDaemons<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ncd \/Library\/LaunchDaemons\r\nsudo ln -s \/Users\/kyle\/etc\/launchctl\/com.agendaless.supervisord.plist .\r\n<\/pre>\n<p>\u6700\u540e\u901a\u8fc7 launchctl \u547d\u4ee4\u6765\u542f\u7528\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo launchctl load \/Library\/LaunchDaemons\/com.agendaless.supervisord.plist\r\n<\/pre>\n<h1>Mac\u81ea\u542f\u52a8\u7684\u51e0\u79cd\u65b9\u5f0f<\/h1>\n<h2>1\u3001Login Items<\/h2>\n<p>Mac OSX\u7684\u5f53\u524d\u7528\u6237\u6210\u529f\u767b\u5f55\u540e\u542f\u52a8\u7684\u7a0b\u5e8f\uff0c\u8be5\u7c7b\u522b\u7684\u542f\u52a8\u9879\u914d\u7f6e\u6587\u4ef6\u5b58\u653e\u5728~\/Library\/Preferences\/com.apple.loginitems.plist\uff0c\u6240\u4ee5\u53ea\u9488\u5f53\u524d\u7528\u6237\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u5f0f\u8fdb\u884c\u8bbe\u7f6e\uff1a<\/p>\n<ol>\n<li>\u5728\u7cfb\u7edf\u504f\u597d\u8bbe\u7f6e\u7684\u201c\u7528\u6237\u4e0e\u7fa4\u7ec4\u201d\u4e0b\u9762\u8fdb\u884c\u8bbe\u7f6e\uff0c\u53ef\u4ee5\u5220\u9664\u3001\u6dfb\u52a0\u3001\u5f00\u542f\u548c\u5173\u95ed;<\/li>\n<li>\u4f60\u53ef\u4ee5\u76f4\u63a5\u4fee\u6539~\/Library\/Preferences\/com.apple.loginitems.plist\u914d\u7f6e\u6587\u4ef6\uff0c\u5176\u4e2d\u6bcf\u4e00\u4e2a\u542f\u52a8\u9879\u5bf9\u5e94\u4e00\u4e2a\u5b57\u5178\uff0c\u6709Alias\u3001Icon\u3001Name\u4e09\u4e2a\u503c\uff0c\u5176\u4e2dName\u662fNSString\u7c7b\u578b\uff0c\u5176\u5b83\u662fData\u7c7b\u578b\uff0c\u5c1a\u4e0d\u77e5\u5982\u6b64\u5e8f\u5217\u5316\u751f\u6210\uff0c\u6240\u4ee5\u76ee\u524d\u53ef\u4ee5\u5220\u9664;<\/li>\n<\/ol>\n<h2>2\u3001Launchd Daemon<\/h2>\n<p>\u6b64\u7c7b\u578b\u7684\u542f\u52a8\u9879\u90fd\u7531launchd\u6765\u8d1f\u8d23\u542f\u52a8\uff0claunchd\u662fMac OS\u4e0b\u7528\u4e8e\u521d\u59cb\u5316\u7cfb\u7edf\u73af\u5883\u7684\u5173\u952e\u8fdb\u7a0b\uff0c\u5b83\u662f\u5185\u6838\u88c5\u8f7d\u6210\u529f\u4e4b\u540e\u5728OS\u73af\u5883\u4e0b\u542f\u52a8\u7684\u7b2c\u4e00\u4e2a\u8fdb\u7a0b\u3002\u91c7\u7528\u8fd9\u79cd\u65b9\u5f0f\u6765\u914d\u7f6e\u81ea\u542f\u52a8\u9879\u5f88\u7b80\u5355\uff0c\u53ea\u9700\u8981\u4e00\u4e2aplist\u6587\u4ef6\uff0c\u8be5plist\u6587\u4ef6\u5b58\u5728\u7684\u76ee\u5f55\u6709<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n~\/Library\/LaunchAgents\r\n\/Library\/LaunchAgents\r\n\/System\/Library\/LaunchAgents\r\n<\/pre>\n<p>\u4ee5\u4e0a\u4e09\u4e2a\u76ee\u5f55\u4e3a\u7cfb\u7edf\u63a8\u8350\u653e\u7f6e\u7684\u8def\u5f84\uff0c\u662f\u5f53\u767b\u5f55\u4e4b\u540e\u542f\u52a8\u7684\u8fdb\u7a0b<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n~\/Library\/LaunchDaemons\r\n\/Library\/LaunchDaemons\r\n\/System\/Library\/LaunchDaemons\r\n<\/pre>\n<p>\u653e\u7f6e\u5728\u4ee5\u4e0a\u4e09\u4e2a\u76ee\u5f55\uff0c\u5219\u542f\u52a8\u4e3a\u5b88\u62a4\u8fdb\u7a0b\uff0c\u4e3a\u7cfb\u7edf\u542f\u52a8\u540e\u7acb\u5373\u542f\u52a8\u7684\u8fdb\u7a0b<\/p>\n<p>\u4e0d\u540c\u7684\u76ee\u5f55\u8fdb\u7a0b\u542f\u52a8\u7684\u6743\u9650\u548c\u4f18\u5148\u7ea7\u662f\u4e0d\u4e00\u6837\u7684\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u7684\u65b9\u5f0f\u8fdb\u884c\u8bbe\u7f6e\uff1a<\/p>\n<ol>\n<li>\u901a\u8fc7launchctl load xxx.plist\u6216launchctl unload xxx.plist\u547d\u4ee4\u6dfb\u52a0\u548c\u5220\u9664\u6307\u5b9a\u542f\u52a8\u9879\uff1b<\/li>\n<li>\u76f4\u63a5\u521b\u5efa\u3001\u4fee\u6539\u3001\u5220\u9664\u76f8\u5173\u76ee\u5f55\u4e0b\u9762\u7684plist\u6587\u4ef6\u3002<\/li>\n<\/ol>\n<h2>3\u3001StartupItems<\/h2>\n<p>StartupItems\uff0c\u987e\u540d\u601d\u4e49\uff0c\u5c31\u662f\u5728\u7cfb\u7edf\u542f\u52a8\u8fc7\u7a0b\u4e2d\u8fd0\u884c\u7684\u7a0b\u5e8f\uff0c\u5b83\u4eec\u53ef\u4ee5\u662f\u8fd0\u884c\u5b8c\u5c31\u7acb\u5373\u7ec8\u6b62\u7684\u7a0b\u5e8f\uff08\u6bd4\u5982\uff0c\u5f00\u673a\u6e05\u7a7a\u5e9f\u7eb8\u7bd3\uff09\uff0c\u4e5f\u53ef\u4ee5\u662f\u4e00\u76f4\u6301\u7eed\u5728\u7cfb\u7edf\u8fd0\u884c\u5468\u671f\u7684\u540e\u53f0\u8fdb\u7a0b\u3002<\/p>\n<p>StartupItems\u4e00\u822c\u5b58\u653e\u5728\u4ee5\u4e0b\u4e24\u4e2a\u8def\u5f84\u4e0b\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\/System\/Library\/StartupItems\r\n\/Library\/StartupItems\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u8bbe\u7f6e supervisord \u4e3a\u7cfb\u7edf\u81ea\u542f\u52a8\u3002 \u6dfb\u52a0 plist \u542f\u52a8\u914d\u7f6e\u6587\u4ef6\uff1a cat \/Users\/kyle [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-6129","post","type-post","status-publish","format-standard","hentry","category-skill"],"_links":{"self":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/6129","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/comments?post=6129"}],"version-history":[{"count":4,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/6129\/revisions"}],"predecessor-version":[{"id":6133,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/6129\/revisions\/6133"}],"wp:attachment":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/media?parent=6129"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/categories?post=6129"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/tags?post=6129"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}