{"id":1138,"date":"2022-05-11T16:47:53","date_gmt":"2022-05-11T08:47:53","guid":{"rendered":"https:\/\/www.linuxdevops.cn\/?p=1138"},"modified":"2022-06-24T10:20:16","modified_gmt":"2022-06-24T02:20:16","slug":"php-process-daemon-script","status":"publish","type":"post","link":"https:\/\/www.linuxdevops.cn\/2022\/05\/php-process-daemon-script\/","title":{"rendered":"PHP \u8fdb\u7a0b\u5b88\u62a4\u811a\u672c"},"content":{"rendered":"
#!\/bin\/bash\nPRO_NAME=test\ncd \/home\/wwwroot\/default\nwhile true ; do\n     #\u7528ps\u83b7\u53d6$PRO_NAME\u8fdb\u7a0b\u6570\u91cf\n     NUM=`ps aux | grep -w "\/usr\/bin\/php think ${PRO_NAME}" | grep -v grep |wc -l`\n     #echo $NUM\n     #\u5c11\u4e8e1\uff0c\u91cd\u542f\u8fdb\u7a0b\n     if [ "${NUM}" -lt "1" ];then\n         echo "${PRO_NAME} was killed"\n         nohup \/usr\/bin\/php think ${PRO_NAME} >> ${PRO_NAME}.log 2>&1  &\n    #\u5927\u4e8e1\uff0c\u6740\u6389\u6240\u6709\u8fdb\u7a0b\uff0c\u91cd\u542f\n    elif [ "${NUM}" -gt "1" ];then\n        echo "more than 1 ${PRO_NAME},killall ${PRO_NAME}"\n        ps aux | grep -w ${PRO_NAME} | grep -v grep |grep -v ${PRO_NAME}_deamon.sh |awk '{print $2}' |xargs kill -9\n        nohup  \/usr\/bin\/php think ${PRO_NAME} >> ${PRO_NAME}.log 2>&1  &\n     fi\n     sleep 5s\ndone\n\nexit 0<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"

#!\/bin\/bash PRO_NAME=test cd \/home\/wwwroot\/default whil<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,14],"tags":[110,29],"yoast_head":"\nPHP \u8fdb\u7a0b\u5b88\u62a4\u811a\u672c - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.linuxdevops.cn\/2022\/05\/php-process-daemon-script\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PHP \u8fdb\u7a0b\u5b88\u62a4\u811a\u672c - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\" \/>\n<meta property=\"og:description\" content=\"#!\/bin\/bash PRO_NAME=test cd \/home\/wwwroot\/default whil\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.linuxdevops.cn\/2022\/05\/php-process-daemon-script\/\" \/>\n<meta property=\"og:site_name\" content=\"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\" \/>\n<meta property=\"article:published_time\" content=\"2022-05-11T08:47:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-24T02:20:16+00:00\" \/>\n<meta name=\"author\" content=\"\u7ba1\u7406\u5458\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.linuxdevops.cn\/2022\/05\/php-process-daemon-script\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/2022\/05\/php-process-daemon-script\/\"},\"author\":{\"name\":\"\u7ba1\u7406\u5458\",\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1\"},\"headline\":\"PHP \u8fdb\u7a0b\u5b88\u62a4\u811a\u672c\",\"datePublished\":\"2022-05-11T08:47:53+00:00\",\"dateModified\":\"2022-06-24T02:20:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/2022\/05\/php-process-daemon-script\/\"},\"wordCount\":1,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1\"},\"keywords\":[\"PHP\u8fdb\u7a0b\u5b88\u62a4\u811a\u672c\",\"shell\"],\"articleSection\":[\"Linux\",\"Shell\"],\"inLanguage\":\"zh-CN\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.linuxdevops.cn\/2022\/05\/php-process-daemon-script\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.linuxdevops.cn\/2022\/05\/php-process-daemon-script\/\",\"url\":\"https:\/\/www.linuxdevops.cn\/2022\/05\/php-process-daemon-script\/\",\"name\":\"PHP \u8fdb\u7a0b\u5b88\u62a4\u811a\u672c - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\",\"isPartOf\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/#website\"},\"datePublished\":\"2022-05-11T08:47:53+00:00\",\"dateModified\":\"2022-06-24T02:20:16+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/2022\/05\/php-process-daemon-script\/#breadcrumb\"},\"inLanguage\":\"zh-CN\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.linuxdevops.cn\/2022\/05\/php-process-daemon-script\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.linuxdevops.cn\/2022\/05\/php-process-daemon-script\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.linuxdevops.cn\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux\",\"item\":\"https:\/\/www.linuxdevops.cn\/linux\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"PHP \u8fdb\u7a0b\u5b88\u62a4\u811a\u672c\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.linuxdevops.cn\/#website\",\"url\":\"https:\/\/www.linuxdevops.cn\/\",\"name\":\"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\",\"description\":\"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\u7b14\u8bb0\",\"publisher\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1\"},\"alternateName\":\"linuxdevops\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.linuxdevops.cn\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-CN\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1\",\"name\":\"\u7ba1\u7406\u5458\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-CN\",\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.linuxdevops.cn\/wp-content\/uploads\/2019\/07\/cropped-index.jpg\",\"contentUrl\":\"https:\/\/www.linuxdevops.cn\/wp-content\/uploads\/2019\/07\/cropped-index.jpg\",\"width\":512,\"height\":512,\"caption\":\"\u7ba1\u7406\u5458\"},\"logo\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/image\/\"},\"description\":\"\u7ba1\u7406\u5458\",\"url\":\"https:\/\/www.linuxdevops.cn\/author\/root\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PHP \u8fdb\u7a0b\u5b88\u62a4\u811a\u672c - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","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":"https:\/\/www.linuxdevops.cn\/2022\/05\/php-process-daemon-script\/","og_locale":"zh_CN","og_type":"article","og_title":"PHP \u8fdb\u7a0b\u5b88\u62a4\u811a\u672c - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","og_description":"#!\/bin\/bash PRO_NAME=test cd \/home\/wwwroot\/default whil","og_url":"https:\/\/www.linuxdevops.cn\/2022\/05\/php-process-daemon-script\/","og_site_name":"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","article_published_time":"2022-05-11T08:47:53+00:00","article_modified_time":"2022-06-24T02:20:16+00:00","author":"\u7ba1\u7406\u5458","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.linuxdevops.cn\/2022\/05\/php-process-daemon-script\/#article","isPartOf":{"@id":"https:\/\/www.linuxdevops.cn\/2022\/05\/php-process-daemon-script\/"},"author":{"name":"\u7ba1\u7406\u5458","@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1"},"headline":"PHP \u8fdb\u7a0b\u5b88\u62a4\u811a\u672c","datePublished":"2022-05-11T08:47:53+00:00","dateModified":"2022-06-24T02:20:16+00:00","mainEntityOfPage":{"@id":"https:\/\/www.linuxdevops.cn\/2022\/05\/php-process-daemon-script\/"},"wordCount":1,"commentCount":0,"publisher":{"@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1"},"keywords":["PHP\u8fdb\u7a0b\u5b88\u62a4\u811a\u672c","shell"],"articleSection":["Linux","Shell"],"inLanguage":"zh-CN","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.linuxdevops.cn\/2022\/05\/php-process-daemon-script\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.linuxdevops.cn\/2022\/05\/php-process-daemon-script\/","url":"https:\/\/www.linuxdevops.cn\/2022\/05\/php-process-daemon-script\/","name":"PHP \u8fdb\u7a0b\u5b88\u62a4\u811a\u672c - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","isPartOf":{"@id":"https:\/\/www.linuxdevops.cn\/#website"},"datePublished":"2022-05-11T08:47:53+00:00","dateModified":"2022-06-24T02:20:16+00:00","breadcrumb":{"@id":"https:\/\/www.linuxdevops.cn\/2022\/05\/php-process-daemon-script\/#breadcrumb"},"inLanguage":"zh-CN","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.linuxdevops.cn\/2022\/05\/php-process-daemon-script\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.linuxdevops.cn\/2022\/05\/php-process-daemon-script\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.linuxdevops.cn\/"},{"@type":"ListItem","position":2,"name":"Linux","item":"https:\/\/www.linuxdevops.cn\/linux\/"},{"@type":"ListItem","position":3,"name":"PHP \u8fdb\u7a0b\u5b88\u62a4\u811a\u672c"}]},{"@type":"WebSite","@id":"https:\/\/www.linuxdevops.cn\/#website","url":"https:\/\/www.linuxdevops.cn\/","name":"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","description":"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\u7b14\u8bb0","publisher":{"@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1"},"alternateName":"linuxdevops","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.linuxdevops.cn\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-CN"},{"@type":["Person","Organization"],"@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1","name":"\u7ba1\u7406\u5458","image":{"@type":"ImageObject","inLanguage":"zh-CN","@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/image\/","url":"https:\/\/www.linuxdevops.cn\/wp-content\/uploads\/2019\/07\/cropped-index.jpg","contentUrl":"https:\/\/www.linuxdevops.cn\/wp-content\/uploads\/2019\/07\/cropped-index.jpg","width":512,"height":512,"caption":"\u7ba1\u7406\u5458"},"logo":{"@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/image\/"},"description":"\u7ba1\u7406\u5458","url":"https:\/\/www.linuxdevops.cn\/author\/root\/"}]}},"_links":{"self":[{"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/posts\/1138"}],"collection":[{"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/comments?post=1138"}],"version-history":[{"count":3,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/posts\/1138\/revisions"}],"predecessor-version":[{"id":1153,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/posts\/1138\/revisions\/1153"}],"wp:attachment":[{"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/media?parent=1138"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/categories?post=1138"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/tags?post=1138"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}