# swoole-tools **Repository Path**: wocaa/swoole-tools ## Basic Information - **Project Name**: swoole-tools - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2017-08-18 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # SwooleTools * 监听目录变化自动重启swoole_server ## 安装 * 依赖inotify和swoole扩展 ```js pecl install swoole pecl install inotify ``` ## Usage ```php composer require rookiejin/swoole_tooles touch reload.php # code 如下 watch($dir,$master_pid,$ext,$interval); }else{ echo "please input pid" . PHP_EOL ; } ``` * 在命令行执行 ```js php reload.php 23869 // 或者 php reload.php /tmp/swoole.pid ``` ```shell ps -axf | grep php 23869 pts/30 S 0:00 php index.php 24139 pts/30 S 0:00 \_ php index.php 24140 pts/30 S 0:00 \_ php index.php 24141 pts/30 S 0:00 \_ php index.php 24142 pts/30 S 0:00 \_ php index.php 24143 pts/30 S 0:00 \_ php index.php 24144 pts/30 S 0:00 \_ php index.php 24145 pts/30 S 0:00 \_ php index.php 24146 pts/30 S 0:00 \_ php index.php ``` php reload.php 23869 或者 使用pidfile 是将pid保存在这个文件里面了,程序直接会去读这个文件。 ## 注意 要先启动 swoole_server 再启用reload * 感谢 @matyhtf [swoole/auto_reload](https://github.com/swoole/auto_reload)