Files
server/fix-log-permissions.sh
2025-11-01 17:02:16 +08:00

39 lines
895 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
echo "=== 日志权限修复脚本 ==="
echo
DEPLOY_DIR="/root/server/archive"
LOGS_DIR="$DEPLOY_DIR/logs"
if [ ! -d "$LOGS_DIR" ]; then
echo "❌ 日志目录不存在: $LOGS_DIR"
echo "正在创建日志目录..."
mkdir -p "$LOGS_DIR"
fi
echo "🔧 修复日志目录权限..."
# 设置目录权限
chmod 755 "$LOGS_DIR"
# 设置所有者app 用户的 UID/GID 是 1001
chown -R 1001:1001 "$LOGS_DIR" 2>/dev/null || echo "⚠️ 无法设置所有者,但权限已设置"
# 显示权限信息
echo "✓ 权限修复完成"
echo
echo "📋 目录权限信息:"
ls -la "$LOGS_DIR"
echo
echo "📋 目录所有者信息:"
ls -la "$DEPLOY_DIR" | grep logs
echo
echo "🚀 现在可以重启服务:"
echo " ./archive-manager.sh restart"
echo
echo "或者手动重启容器:"
echo " docker stop digital-archive-app"
echo " docker start digital-archive-app"