SwooleFor监控你的Swoole程序文件变化并自动重启服务器——适合开发监控你的swoole应用有任何变化并自动重启服务器——完美的开发定位SwooleFor就像PHP版的nodemon,node-dev本项目使用mix-phar开发依赖扩展(Dependextensions)ext-swoole>=v4.4ext-inotify下载(Download)https://github.com/mix-php/swoole使用(用法)执行脚本命令:phpswoolefor.phar--exec="phpapp.phparg..."如果disable_functions禁用proc_open方法,执行如下:php-ddisable_functions=''swoolefor.phar--exec="phpapp.phparg..."启动成功:_____________/___/__________//__/____/________\__\|/|//__\/__\//_\//_/__\/___/___//|/|///_///_///__/__///_////____/|__/|__/\____/\____/_/\___/_/\____/_/版本:1.1.1,Swoole:4.4.0[信息]2019-08-1411:51:05.937<920>[message]executorstart,exec:[php/data/bin/mix-httpdstart][info]2019-08-1411:51:05.938<920>[message]forksubprocess,pid:921[info]2019-08-1411:51:05.939<920>[message]monitorstart[info]2019-08-1411:51:05.939<920>[message]watch:/data[info]2019-08-1411:51:05.939<920>[message]delay:3s[info]2019-08-1411:51:05.939<920>[message]ext:.php,.json所有命令参数phpswoolefor.phar--help-e,--execSwoole应用或其他脚本启动命令-d,--daemon后台运行--watch监听代码文件目录--delay文件changedelayprocessing(seconds)--ext只监听这些扩展的变化--signal将这个信号发送给进程执行脚本命令--exec可以是里面的任何命令,必须是绝对路径,必须是执行的常驻程序在前台(否则会导致不断fork进程)phpswoolefor.phar--exec="phpapp.php"也可以使用短参数phpswoolefor.phar-e"phpapp.php"执行非PHP脚本nodephpswoolefor.phar--exec="nodeapp.js"pythonphpswoolefor.phar--exec="pythonapp.py"ExecuteSwooleForinthebackground本身可以在后台执行,所以可以脱离终端,在phpswoolefor.phar中加上--daemon--exec="nodeapp.js"--daemonis也提供使用短参数phpswoolefor.phar--exec="nodeapp.js"-d指定监控目录--watch默认值为--exec参数中脚本的当前目录,如果脚本在bin目录,会被监控一级目录//会自动监控/data目录phpswoolefor.phar--exec="php/data/bin/app.php"指定监控其他目录phpswoolefor.phar--exec="phpapp.php"--watch=/tmp延迟执行重启当很多文件更新时,我们不希望程序频繁重启,所以需要设置一个延迟执行重启时间,只执行到达设定时间后重新开始运行。--delay默认为3sphpswoolefor.phar--exec="phpapp.php"--delay=5指定要观察的扩展--ext默认为php,json,phpswoolefor需要其他扩展时可以配置观察到的。phar--exec="phpapp.php"--ext=php,json,ini重启时发送的信号程序重启时通过向进程发送信号来终止进程。当我们需要指定一个信号时--signal默认为15phpswoolefor.phar--exec="phpapp.php"--signal=1常用的信号表信号值SIGTERM15SIGKILL9SIGHUP1......支持流行的Swoole框架MixPHP:phpswoolefor.phar-e"php/data/bin/mix-httpdstart-c/data/applications/http/config/httpd.php"Swoft:phpswoolefor.phar-e"php/data/bin/swofthttp:start"EasySwoole:phpswoolefor.phar-e"php/data/bin/easyswoolestart"laravel-sphpswoolefor.phar-e"php/data/bin/laravelsstart"LicenseApache许可证版本2.0,http://www.apache.org/licenses/
