Diagnostic step 1
Move PostgreSQL helper scripts to a directory excluded from system-wide maintenance (e.g., /usr/local/pgsql/bin) and set strict ownership postgres:postgres and mode 750; update archive_command accordingly.
Generated Oct 3, 2026, 12:35:03 AM
Move PostgreSQL helper scripts to a directory excluded from system-wide maintenance (e.g., /usr/local/pgsql/bin) and set strict ownership postgres:postgres and mode 750; update archive_command accordingly.
Add a lightweight monitoring check: alert when pg_wal directory size or number of WAL files exceeds a threshold and when archival fails (parse PostgreSQL logs and send alert via existing monitoring).
Harden logrotate/postrotate scripts: add explicit include/exclude paths, test on a staging host, and require a dry-run approval for changes that affect system-owned paths.
Create a safe recovery script that verifies file ownership/mode for archive_command helper and NFS writable state and runs as a privileged operator (with audit logging) — document manual steps for immediate fix and avoid automated blind fixes.
Consider enabling 'archive_mode = on' and using a robust archiver (e.g., rsync with checksums or a dedicated backup agent) and place archives on a location whose permissions are managed by configuration management (Ansible/Puppet).