如何在 linux 上的 git 挂钩中重新启动进程
How to restart a process in a git hook on linux
我正在使用 Laravel 的 Lumen 编写网络服务。我想在提交到中央存储库后使用 git 挂钩来更新 Web 服务。根据 lumen 的文档,我必须使用此命令启动 lumen:
php -S localhost:8000 -t public
这将创建一个 php 进程。一种非常笨拙的方法是在上述命令之前使用 killall php
来终止 git 挂钩中的进程,但必须有更好的方法。也许是一种记录 pid 的方法,或者更特定于流明的方法。
您可能希望通过 supervisord 来管理它:
(http://www.supervisord.org/)
如果您将网络服务配置为 mylumenws
您可以:
sudo supervisorctl start/stop/restart mylumenws
Laravel 有一个例子 运行 它的 Queues with supervisord:
(https://lumen.laravel.com/docs/5.1/queues#supervisor-configuration)
我正在使用 Laravel 的 Lumen 编写网络服务。我想在提交到中央存储库后使用 git 挂钩来更新 Web 服务。根据 lumen 的文档,我必须使用此命令启动 lumen:
php -S localhost:8000 -t public
这将创建一个 php 进程。一种非常笨拙的方法是在上述命令之前使用 killall php
来终止 git 挂钩中的进程,但必须有更好的方法。也许是一种记录 pid 的方法,或者更特定于流明的方法。
您可能希望通过 supervisord 来管理它: (http://www.supervisord.org/)
如果您将网络服务配置为 mylumenws 您可以:
sudo supervisorctl start/stop/restart mylumenws
Laravel 有一个例子 运行 它的 Queues with supervisord: (https://lumen.laravel.com/docs/5.1/queues#supervisor-configuration)