fpfgithub / auto_reload

Inotify监控文件变更自动重启swoole_server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

自动重启脚本

  • 使用inotify监听PHP源码目录
  • 程序文件更新时自动reload服务器程序

运行脚本

依赖inotifyswoole扩展

pecl install swoole
pecl install inotify
php daemon.php

运行程序

require __DIR__.'/src/Swoole/ToolKit/AutoReload.php';

//设置服务器程序的PID
$kit = new Swoole\ToolKit\AutoReload(2914);
//设置要监听的源码目录
$kit->watch(__DIR__.'/tests');
//监听后缀为.php的文件
$kit->addFileType('.php');
$kit->run();

About

Inotify监控文件变更自动重启swoole_server


Languages

Language:PHP 100.0%