优化dev脚本,修复热重载监控文件数量过少的问题
This commit is contained in:
parent
193d57de5e
commit
08e4bd5653
20
dev.sh
20
dev.sh
@ -170,11 +170,31 @@ build_reload_dirs() {
|
||||
echo "$RELOAD_DIRS"
|
||||
}
|
||||
|
||||
# 检查并增加 inotify 限制
|
||||
check_inotify_limit() {
|
||||
local current_limit=$(cat /proc/sys/fs/inotify/max_user_watches 2>/dev/null || echo "0")
|
||||
local min_limit=524288
|
||||
|
||||
if [ "$current_limit" -lt "$min_limit" ]; then
|
||||
warn "inotify 限制较低 ($current_limit),尝试增加到 $min_limit..."
|
||||
|
||||
# 临时增加限制(需要 root 权限)
|
||||
if sudo sysctl fs.inotify.max_user_watches=$min_limit 2>/dev/null; then
|
||||
success "inotify 限制已临时增加到 $min_limit"
|
||||
else
|
||||
warn "无法自动增加 inotify 限制(需要 root 权限)"
|
||||
warn "请手动运行: sudo sysctl -w fs.inotify.max_user_watches=524288"
|
||||
warn "或永久设置: echo 'fs.inotify.max_user_watches=524288' | sudo tee -a /etc/sysctl.conf"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# 启动所有服务
|
||||
start_all() {
|
||||
info "启动开发环境..."
|
||||
ensure_uv
|
||||
cleanup
|
||||
check_inotify_limit
|
||||
check_redis
|
||||
check_deps
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user