mac 监控文件变化并重启php
自己撸一个框架,需要监控代码变化
安装fswatch
brew install fswatch
shell重启PHP脚本reload.sh
#!/bin/sh
do
ps -ef | grep php | grep -v grep | awk '{print $2}' | xargs kill -9
php /Users/x/www/php/LightMoon/examples/index.php
done
监控文件变化目录
fswatch -0 /Users/x/www/php/LightMoon| xargs -0 -n 1 /Users/x/www/php/LightMoon/bin/reload.sh