ke-zhi-xing-jiao-ben.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. <!DOCTYPE HTML>
  2. <html lang="" >
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  6. <title>可执行脚本 · GitBook</title>
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  8. <meta name="description" content="">
  9. <meta name="generator" content="GitBook 3.2.3">
  10. <link rel="stylesheet" href="../gitbook/style.css">
  11. <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
  12. <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
  13. <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
  14. <meta name="HandheldFriendly" content="true"/>
  15. <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
  16. <meta name="apple-mobile-web-app-capable" content="yes">
  17. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  18. <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
  19. <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
  20. <link rel="prev" href="tablehelper.html" />
  21. </head>
  22. <body>
  23. <div class="book">
  24. <div class="book-summary">
  25. <div id="book-search-input" role="search">
  26. <input type="text" placeholder="Type to search" />
  27. </div>
  28. <nav role="navigation">
  29. <ul class="summary">
  30. <li class="chapter " data-level="1.1" data-path="../">
  31. <a href="../">
  32. 简介
  33. </a>
  34. </li>
  35. <li class="chapter " data-level="1.2" data-path="../chapter1.html">
  36. <a href="../chapter1.html">
  37. 基础用法
  38. </a>
  39. <ul class="articles">
  40. <li class="chapter " data-level="1.2.1" data-path="../chapter1/pei-zhi.html">
  41. <a href="../chapter1/pei-zhi.html">
  42. 配置
  43. </a>
  44. </li>
  45. <li class="chapter " data-level="1.2.2" data-path="../chapter1/lu-you.html">
  46. <a href="../chapter1/lu-you.html">
  47. 路由
  48. </a>
  49. </li>
  50. <li class="chapter " data-level="1.2.3" data-path="../chapter1/kong-zhi-qi.html">
  51. <a href="../chapter1/kong-zhi-qi.html">
  52. 控制器
  53. </a>
  54. </li>
  55. <li class="chapter " data-level="1.2.4" data-path="../chapter1/mo-xing.html">
  56. <a href="../chapter1/mo-xing.html">
  57. 模型
  58. </a>
  59. </li>
  60. <li class="chapter " data-level="1.2.5" data-path="../chapter1/shi-tu.html">
  61. <a href="../chapter1/shi-tu.html">
  62. 视图
  63. </a>
  64. </li>
  65. </ul>
  66. </li>
  67. <li class="chapter " data-level="1.3" data-path="../qi-ta-bu-chong.html">
  68. <a href="../qi-ta-bu-chong.html">
  69. 其他补充
  70. </a>
  71. <ul class="articles">
  72. <li class="chapter " data-level="1.3.1" data-path="param.html">
  73. <a href="param.html">
  74. Param
  75. </a>
  76. </li>
  77. <li class="chapter " data-level="1.3.2" data-path="tablehelper.html">
  78. <a href="tablehelper.html">
  79. TableHelper
  80. </a>
  81. </li>
  82. <li class="chapter active" data-level="1.3.3" data-path="ke-zhi-xing-jiao-ben.html">
  83. <a href="ke-zhi-xing-jiao-ben.html">
  84. 可执行脚本
  85. </a>
  86. </li>
  87. </ul>
  88. </li>
  89. <li class="divider"></li>
  90. <li>
  91. <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
  92. Published with GitBook
  93. </a>
  94. </li>
  95. </ul>
  96. </nav>
  97. </div>
  98. <div class="book-body">
  99. <div class="body-inner">
  100. <div class="book-header" role="navigation">
  101. <!-- Title -->
  102. <h1>
  103. <i class="fa fa-circle-o-notch fa-spin"></i>
  104. <a href=".." >可执行脚本</a>
  105. </h1>
  106. </div>
  107. <div class="page-wrapper" tabindex="-1" role="main">
  108. <div class="page-inner">
  109. <div id="book-search-results">
  110. <div class="search-noresults">
  111. <section class="normal markdown-section">
  112. <h3 id="&#x53EF;&#x6267;&#x884C;&#x811A;&#x672C;">&#x53EF;&#x6267;&#x884C;&#x811A;&#x672C;</h3>
  113. <h6 id="&#x76EE;&#x5F55;&#x7ED3;&#x6784;">&#x76EE;&#x5F55;&#x7ED3;&#x6784;</h6>
  114. <p>&#x53EF;&#x6267;&#x884C;&#x811A;&#x672C;&#x5B58;&#x653E;&#x5728;<code>bin</code>&#x76EE;&#x5F55;&#x4E0B;&#xFF0C;&#x5EFA;&#x8BAE;&#x4EE5;&#x4E0B;&#x65B9;&#x5F0F;&#x5206;&#x7C7B;</p>
  115. <pre><code>bin
  116. &#x251C;&#x2500;&#x2500; once // &#x5355;&#x6B21;&#x6267;&#x884C;&#x811A;&#x672C;
  117. &#x251C;&#x2500;&#x2500; cron // &#x5B9A;&#x65F6;&#x811A;&#x672C;
  118. &#x251C;&#x2500;&#x2500; supervisor // &#x5E38;&#x9A7B;&#x811A;&#x672C;
  119. &#x2514;&#x2500;&#x2500; spider // &#x5E26;&#x6709;&#x660E;&#x786E;&#x529F;&#x80FD;&#x7684;&#x5206;&#x7C7B;
  120. </code></pre><h6 id="&#x811A;&#x672C;&#x53C2;&#x8003;&#x7ED3;&#x6784;">&#x811A;&#x672C;&#x53C2;&#x8003;&#x7ED3;&#x6784;</h6>
  121. <p>&#x5EFA;&#x8BAE;&#x8F93;&#x51FA;&#x6709;&#x610F;&#x4E49;&#x7684;&#x6267;&#x884C;&#x4FE1;&#x606F;</p>
  122. <pre><code class="lang-php"><span class="hljs-comment">#!/path/to/php</span>
  123. <span class="hljs-meta">&lt;?php</span>
  124. <span class="hljs-comment">// &#x8FD0;&#x884C;&#x65F6;&#x914D;&#x7F6E;</span>
  125. set_time_limit(<span class="hljs-number">0</span>);
  126. ini_set(<span class="hljs-string">&quot;display_errors&quot;</span>, <span class="hljs-string">&quot;On&quot;</span>);
  127. error_reporting(E_ALL &amp; ~E_NOTICE);
  128. <span class="hljs-keyword">require_once</span> realpath(dirname(<span class="hljs-keyword">__FILE__</span>)) . <span class="hljs-string">&apos;/../common.php&apos;</span>; <span class="hljs-comment">// &#x9879;&#x76EE;&#x4F9D;&#x8D56;&#x914D;&#x7F6E;</span>
  129. <span class="hljs-comment">// &#x5982;&#x679C;&#x8FD9;&#x4E2A;&#x811A;&#x672C;&#x53EA;&#x80FD;&#x5355;&#x8FDB;&#x7A0B;&#x8FDB;&#x884C;</span>
  130. $pidFile = BASE_DIR . <span class="hljs-string">&apos;/protected/bin/run/script_name.pid&apos;</span>;
  131. <span class="hljs-keyword">if</span> (!singleProcess(getCurrentCommand(), $pidFile)) {
  132. <span class="hljs-keyword">exit</span>(<span class="hljs-string">&quot;Sorry, this script file has already been running ...,pid:{$pidFile}\n&quot;</span>);
  133. }
  134. <span class="hljs-comment">// &#x4E1A;&#x52A1;&#x903B;&#x8F91;</span>
  135. </code></pre>
  136. </section>
  137. </div>
  138. <div class="search-results">
  139. <div class="has-results">
  140. <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
  141. <ul class="search-results-list"></ul>
  142. </div>
  143. <div class="no-results">
  144. <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
  145. </div>
  146. </div>
  147. </div>
  148. </div>
  149. </div>
  150. </div>
  151. <a href="tablehelper.html" class="navigation navigation-prev navigation-unique" aria-label="Previous page: TableHelper">
  152. <i class="fa fa-angle-left"></i>
  153. </a>
  154. </div>
  155. <script>
  156. var gitbook = gitbook || [];
  157. gitbook.push(function() {
  158. gitbook.page.hasChanged({"page":{"title":"可执行脚本","level":"1.3.3","depth":2,"previous":{"title":"TableHelper","level":"1.3.2","depth":2,"path":"qi-ta-bu-chong/tablehelper.md","ref":"qi-ta-bu-chong/tablehelper.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"qi-ta-bu-chong/ke-zhi-xing-jiao-ben.md","mtime":"2018-09-13T03:07:10.933Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-13T03:13:15.790Z"},"basePath":"..","book":{"language":""}});
  159. });
  160. </script>
  161. </div>
  162. <script src="../gitbook/gitbook.js"></script>
  163. <script src="../gitbook/theme.js"></script>
  164. <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
  165. <script src="../gitbook/gitbook-plugin-search/search.js"></script>
  166. <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
  167. <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
  168. <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
  169. <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
  170. </body>
  171. </html>