Contents
Changelog
1.8.1
- Fixed (PHP, Bash; since 1.7.0): the per-cluster temp directory was created by root with mode
0700, sopg_dump/pg_dumpallrunning aspostgrescould not write into it and every Linux backup aborted with “Permission denied” (e.g.pg_dumpall: error: could not open output file "/tmp/18_main/globals.sql"). The directory now belongs topostgres; the configuredtempdironly needs to be traversable forpostgres. - Fixed (PHP): without
date.timezoneinphp.ini, PHP CLI runs in UTC, so between midnight and the UTC offset the backup landed in the previous day’s folder and log times were off. The script now uses the system time zone (TZ,/etc/timezone,/etc/localtime), like the bash port. An explicitdate.timezonestill wins. - PowerShell: no functional changes; version bumped to match the release.
1.8.0
- Added database include/exclude filters:
exclude_databases(CLI--exclude, PowerShell-ExcludeDatabases) andinclude_databases(CLI--include, PowerShell-IncludeDatabases) supporting comma-separated glob patterns (test_*,*_tmp). - Added database size querying and disk-space pre-flight check: queries
pg_database_size, displays formatted raw size on dump start, and validates free disk space onbackupdirandtempdirifmin_free_space_gbis configured. - Added dry-run simulation mode (
-N/--dry-run, PowerShell-DryRun/-WhatIf): inspects clusters, enumerates databases and sizes, tests include/exclude filters, displays target dump paths and planned rotation without executing dumps or deleting files. - Added compression level tuning (
-Z/--compress, PowerShell-Compression): passes custom compression level or specification (e.g.6,zstd:3) directly topg_dump. - Added backup manifest (
manifest.json): writes structured JSON metadata per cluster containing start/end timestamps, duration, pg_version, cluster name, database raw and dump file sizes, and globals dump status. - Added healthcheck / monitoring webhook (
ping_url, CLI--ping-url, PowerShell-PingUrl): sends start ping (<ping_url>/start), success ping (<ping_url>), and failure ping (<ping_url>/fail) compatible with Healthchecks.io, Uptime Kuma, and Cronitor.
1.7.0
- Added
-C/parallel_clusters(default1= unchanged sequential behavior): dumps up to N clusters concurrently across all three implementations (PHP via background child processes, Bash via background jobs +wait -n, PowerShell via background child processes). Can be combined with-j/parallel_jobsfor concurrent database dumps within each cluster. - Added per-cluster rotation: old backup generations are now pruned immediately after each
cluster’s backup completes (
delete_cluster), rather than waiting for the entire host run to finish. Prunes older generations for that specific cluster and cleans up empty date directories. - Added per-cluster temp isolation: in-progress dumps and
globals.sqlare written to a dedicated cluster subfolder (<tempdir>/<version>_<cluster>/), eliminating file collisions and race conditions when multiple clusters are processed concurrently. - Added cluster log prefix: all cluster-specific log entries are tagged with
[<cluster>](e.g.2026-09-14 20:15:00 [main] Starting backup Database: app_db), ensuring clean readability when logs from concurrent clusters interleave inpg_backupcluster.logand the mail summary.
1.6.0
- Added
-j/parallel_jobs(default1= unchanged sequential behavior): dumps up to N databases per cluster concurrently in all three implementations (PHP via aproc_open()worker pool, Bash via background jobs +wait -n, PowerShell viaStart-Processpolling). Clusters themselves are still processed one at a time. Deliberately notpg_dump’s own-j/--jobs, which requires the directory format and would turn each database’s backup into a directory of files instead of the single.cusfile this project’s restore story promises. See SPEC.md “Parallel database dumps” for the shared requirements (worker-pool pattern, let already-running jobs finish on the first failure, globals never parallelized). - Verified in all three implementations against dummy stand-in processes (not real
pg_dump): concurrency bound respected, correct pool refill as slots free up, failure detection and propagation, and-j 1behaving identically to the previous strictly sequential code.
1.5.0
- Added the PowerShell port (
powershell/pg_clusterbackup.ps1). Windows has nopg_lsclustersequivalent, so discovery is a new, dedicated strategy: enumerate Windows services runningpg_ctl.exeviaGet-CimInstance Win32_Service, read the data directory straight from the service’s own-Dcommand-line argument (not guessed from a path convention), with apgdata_globs-style glob scan as fallback for non-service/portable installs. Deliberately not a port scanner or blind directory scan — see SPEC.md “Cluster / instance discovery” strategy 3. - PowerShell deviation (documented in SPEC.md):
-D/-dcan’t coexist as PowerShell only parameter names/aliases are case-insensitive, so debug level is-DebugLevel/-dlinstead of-d; long options use full names (-Help,-IniWrite, …) rather than--double-dash. - No Windows local MTA, so mail sending requires an
smtp_serverini setting; skipped (logged, not fatal) when unset. - No
sudo -u postgresequivalent on Windows — requirespg_hba.conf/credentials that let the running user connect as thepostgresrole vialocalhost. - PHP/Bash: no functional changes, version bumped to 1.5.0 to match the project-wide release.
- Verified: parser/AST check,
-Help,-IniWrite/-IniShowroundtrip, and both discovery strategies (service-based and glob fallback, running/not-running) against simulated data directories and a mockedWin32_Serviceobject.
1.4.0
- Added the Bash port (
bash/pg_clusterbackup.sh), matching SPEC.md: same CLI options, ini format (incl.pgdata_globs[]), lock file, both discovery strategies, delete-after-success rotation, and cross-filesystem-safe moves (mvalready handles this natively on Linux). Arguments are passed to commands as separate argv entries rather than interpolated into a shell string, so there’s noescapeshellarg-equivalent needed for injection-safety. - PHP: no functional changes, version bumped to 1.4.0 to match the project-wide release (see SPEC.md “Versioning” — the project shares one version number across implementations).
1.3.0 (PHP)
- Added RHEL/CentOS/Rocky/Alma support: when
pg_lsclustersisn’t installed, falls back to scanning configurablepgdata_globsand readingpostmaster.piddirectly for port/socket dir. See SPEC.md “Cluster / instance discovery” for the design. - Fixed
ini_get_settings()writing array-type settings under a[section]header, which caused every setting written after it to be silently absorbed into that array on the next--ini-write/read. Surfaced by adding the first real array setting (pgdata_globs).
1.2.0 (PHP)
Initial public release. Rewrite of a long-standing internal script, hardened for release:
- Fixed
load_ini()referencing an undefined variable, which crashed with a fatal error on any run after the first--ini-write. - Fixed CLI argument parsing —
-D,-T,-L,-F,-h,-d,-n,--emailwere previously silently ignored. - Fixed
mkdir()using a decimal instead of octal permission mode. - Old backup generations are now only deleted after a successful run, not before.
- All values interpolated into shell commands are now shell-escaped.
- Moving dumps from the temp directory to the backup directory now falls back to copy+remove when they’re on different filesystems, and errors are no longer silently swallowed.
- Fixed a fatal error in the failure-mail path when the backup object itself failed to construct.
- Added a lock file so overlapping cron runs can no longer corrupt each other’s temp files.
- Restricted
umaskso temporary dump files aren’t briefly world-readable. - Fixed the executable bit not being tracked correctly by git on Windows.
logdiris now created before first use, and the example config points it at its own subfolder instead of the backup root.
Unreleased
Nothing pending right now.