{"id":13676329,"url":"https://github.com/kcloze/multiprocess","last_synced_at":"2025-12-30T14:04:48.665Z","repository":{"id":57005095,"uuid":"97895916","full_name":"kcloze/multiprocess","owner":"kcloze","description":"🚀Easy to make the common PHP/Python/js...script change daemon and multi-process execution","archived":false,"fork":false,"pushed_at":"2019-09-25T03:14:51.000Z","size":815,"stargazers_count":152,"open_issues_count":0,"forks_count":20,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-05-22T18:33:17.580Z","etag":null,"topics":["cli","daemon","manager","multiprocessing","php","process","swoole"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kcloze.png","metadata":{"files":{"readme":"README.en.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-21T02:11:35.000Z","updated_at":"2024-03-18T13:58:09.000Z","dependencies_parsed_at":"2022-08-21T12:40:37.128Z","dependency_job_id":null,"html_url":"https://github.com/kcloze/multiprocess","commit_stats":null,"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kcloze%2Fmultiprocess","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kcloze%2Fmultiprocess/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kcloze%2Fmultiprocess/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kcloze%2Fmultiprocess/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kcloze","download_url":"https://codeload.github.com/kcloze/multiprocess/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251450656,"owners_count":21591407,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","daemon","manager","multiprocessing","php","process","swoole"],"created_at":"2024-08-02T13:00:23.007Z","updated_at":"2025-12-30T14:04:48.637Z","avatar_url":"https://github.com/kcloze.png","language":"PHP","readme":"# multiprocess [[中文文档]](README.md)\n\n* Based on swoole script management, for multi-process and daemon management\n* Easy to make the common PHP script change daemon and multi-process execution\n* The number of processes can be configured and multiple commands can be executed at once\n* Automatic restart when the child process exits in an abnormal way\n* When the main process exits in an abnormal way, the sub-process exits (smoothing out) after the work is done.\n* Not limited programming language, PHP/Python/Java/Golang/C# and other scripts can be managed\n\n\n\n## Scenario\n\n* PHP requires running one or more cli script consumption queues (resident)\n* The implementation of the script automatically pulls up after the exit, preventing the consumption queue from working, affecting the business\n* In fact, the supervisor can easily do something, this is just another implementation of PHP, no need to change the technology stack\n\n## Flow\n![流程图](flow.png)\n\n\n## Installation\n* git clone https://github.com/kcloze/multiprocess.git\n* composer install\n* modify config.php based on your business configuration\n\n\n## Configure the instance\n* Execute multiple commands at once\n```\n    'logPath'   =\u003e __DIR__ . '/log',\n    'exec'      =\u003e [\n        [\n            'name'      =\u003e 'kcloze-test-1',\n            'bin'       =\u003e '/usr/bin/php',\n            'binArgs'   =\u003e [__DIR__ . '/test/test.php', 'oop', '123'],\n            'workNum'   =\u003e 3,\n        ],\n        [\n            'name'      =\u003e 'kcloze-test-2',\n            'bin'       =\u003e '/usr/bin/php',\n            'binArgs'   =\u003e [__DIR__ . '/test/test2.php', 'oop', '456'],\n            'workNum'   =\u003e 5,\n        ],\n        [\n            'name'      =\u003e 'kcloze-test-3',\n            'bin'       =\u003e '/usr/bin/python',\n            'binArgs'   =\u003e [__DIR__ . '/test/test3.py', 'oop', '369'],\n            'workNum'   =\u003e 2,\n        ],\n    ],\n\n```\n## Running\n\n### 1.start\n* chmod -R u+r log/\n* php multiprocess.php start \u003e\u003e log/worker.log 2\u003e\u00261\n### 2.stop\n* php multiprocess.php stop\n### 3.exit\n* php multiprocess.php exit\n### 4.restart\n* php multiprocess.php restart \u003e\u003e log/worker.log 2\u003e\u00261\n### 5.monitor\n* ps -ef|grep 'multi-process'\n\n### Command\n```\nNAME\n      php multiprocess - manage multiprocess\n\nSYNOPSIS\n      php multiprocess -s command [options] -c config file path\n          Manage multiprocess daemons.\n\n\nWORKFLOWS\n\n\n      help [command]\n      Show this help, or workflow help for command.\n\n      -s restart\n      Stop, then start multiprocess master and workers.\n\n      -s start \n      Start multiprocess master and workers.\n      -s start -c ./config\n      Start multiprocess with specail config file.\n\n\n\n      -s stop\n      Wait all running workers smooth exit, please check multiprocess status for a while.\n\n      -s exit\n      Kill all running workers and master PIDs.\n\n```\n\n\n\n## Monitor\n\n![monitor img](monitor.png)\n\n## Change log\n\n#### 2017-11-30\n* Refactor mercilessly v2 version \n* Add exit param，waiting for the child processes run over\n\n\n## Thanks\n\n* [swoole](http://www.swoole.com/)\n\n## Contact\n\nQQ group：141059677\n\n","funding_links":[],"categories":["Process","Swoole"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkcloze%2Fmultiprocess","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkcloze%2Fmultiprocess","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkcloze%2Fmultiprocess/lists"}