加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
fswatch.sh 663 Bytes
一键复制 编辑 原始数据 按行查看 历史
xiaomingchang 提交于 2019-09-05 20:30 . first commit
#!/usr/bin/env bash
DIR=$1
if [ ! -n "$DIR" ] ;then
echo "you have not choice Application directory !"
exit
fi
cd $DIR
pid=$(cat "$DIR/storage/logs/swoole_http.pid");
if [ $? -ne 0 ]; then
# 请开启守护进程模式,否则会阻塞在start阶段导致fswatch失效
php fast http:stop
php fast http:start -d
fi
echo "Starting fswatch..."
LOCKING=0
fswatch -e ".*" -i "\\.php$" ${DIR} | while read file
do
if [ ${LOCKING} -eq 1 ] ;then
echo "Reloading, skipped."
continue
fi
echo $(date "+%Y-%m-%d %H:%M:%S")": File ${file} has been modified."
LOCKING=1
php fast http:reload
LOCKING=0
done
exit 0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化