判断 CentOS 中 Compton 是否正常运行
快速检查
pgrep -x compton 或 ps -e | grep -E 'compton\b'。有输出且 PID 稳定,通常表示已启动。compton --version,能输出版本号说明二进制可用。compton --verbose 或 compton -f,若前台无报错并接管合成,说明基本可用(按 Ctrl+C 退出前台)。top -p "$(pgrep -x compton)" 或 htop 观察是否有持续进程与合理 CPU/内存占用。使用 systemd 判断
sudo systemctl status compton.service,应看到 Active: active (running) 且最近日志无致命错误。sudo journalctl -u compton.service -b,关注启动成功提示与配置加载信息。sudo systemctl enable --now compton.service。配置与日志验证
compton --config ~/.config/compton.conf --dry-run 或 compton --config /etc/xdg/compton.conf -f,无报错表示配置可被解析。常见配置路径为 ~/.config/compton.conf 或 /etc/xdg/compton.conf。cat ~/.cache/compton/compton.log 查看细节。效果验证与常见现象
top/htop 中 CPU 占用不应长期异常偏高;若占用过高,可先切换到更稳定的后端(如在配置中设置 backend=xrender)并减少重绘密集效果。常见异常与处理
pgrep -x compton 确认;若未运行,直接启动 compton & 或使用 systemd 启动;若启动失败,查看 journalctl -u compton.service 的错误提示。compton --config <你的配置> --dry-run 定位语法/路径问题并修正。journalctl 外,检查 ~/.cache/compton/compton.log 与 /var/log/Xorg.0.log 中的相关报错。