From 92402f0fdbf10130bcfa6b8ba2ea47f25d439266 Mon Sep 17 00:00:00 2001 From: Alexander Renz Date: Thu, 8 Jan 2026 11:57:16 +0100 Subject: [PATCH] v3.42.17: Fix systemd service templates - remove invalid --config flag - Service templates now use WorkingDirectory for config loading - Config is read from .dbbackup.conf in /var/lib/dbbackup - Updated SYSTEMD.md documentation to match actual CLI - Removed non-existent --config flag from ExecStart --- SYSTEMD.md | 21 ++++++++++++------- bin/README.md | 4 ++-- .../templates/dbbackup-cluster.service | 5 ++++- .../installer/templates/dbbackup@.service | 5 ++++- 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/SYSTEMD.md b/SYSTEMD.md index de4e41d..6caca49 100644 --- a/SYSTEMD.md +++ b/SYSTEMD.md @@ -116,8 +116,9 @@ sudo chmod 755 /usr/local/bin/dbbackup ### Step 2: Create Configuration ```bash -# Main configuration -sudo tee /etc/dbbackup/dbbackup.conf << 'EOF' +# Main configuration in working directory (where service runs from) +# dbbackup reads .dbbackup.conf from WorkingDirectory +sudo tee /var/lib/dbbackup/.dbbackup.conf << 'EOF' # DBBackup Configuration db-type=postgres host=localhost @@ -128,6 +129,8 @@ compression=6 retention-days=30 min-backups=7 EOF +sudo chown dbbackup:dbbackup /var/lib/dbbackup/.dbbackup.conf +sudo chmod 600 /var/lib/dbbackup/.dbbackup.conf # Instance credentials (secure permissions) sudo tee /etc/dbbackup/env.d/cluster.conf << 'EOF' @@ -157,13 +160,15 @@ Group=dbbackup # Load configuration EnvironmentFile=-/etc/dbbackup/env.d/cluster.conf -# Working directory +# Working directory (config is loaded from .dbbackup.conf here) WorkingDirectory=/var/lib/dbbackup -# Execute backup +# Execute backup (reads .dbbackup.conf from WorkingDirectory) ExecStart=/usr/local/bin/dbbackup backup cluster \ - --config /etc/dbbackup/dbbackup.conf \ --backup-dir /var/lib/dbbackup/backups \ + --host localhost \ + --port 5432 \ + --user postgres \ --allow-root # Security hardening @@ -443,12 +448,12 @@ sudo systemctl status dbbackup-cluster.service # View detailed error sudo journalctl -u dbbackup-cluster.service -n 50 --no-pager -# Test manually as dbbackup user -sudo -u dbbackup /usr/local/bin/dbbackup backup cluster --config /etc/dbbackup/dbbackup.conf +# Test manually as dbbackup user (run from working directory with .dbbackup.conf) +cd /var/lib/dbbackup && sudo -u dbbackup /usr/local/bin/dbbackup backup cluster # Check permissions ls -la /var/lib/dbbackup/ -ls -la /etc/dbbackup/ +ls -la /var/lib/dbbackup/.dbbackup.conf ``` ### Permission Denied diff --git a/bin/README.md b/bin/README.md index 602392e..6d0c43b 100644 --- a/bin/README.md +++ b/bin/README.md @@ -4,8 +4,8 @@ This directory contains pre-compiled binaries for the DB Backup Tool across mult ## Build Information - **Version**: 3.42.10 -- **Build Time**: 2026-01-08_09:54:02_UTC -- **Git Commit**: 83ad62b +- **Build Time**: 2026-01-08_10:18:23_UTC +- **Git Commit**: 682510d ## Recent Updates (v1.1.0) - ✅ Fixed TUI progress display with line-by-line output diff --git a/internal/installer/templates/dbbackup-cluster.service b/internal/installer/templates/dbbackup-cluster.service index be5f405..d404770 100644 --- a/internal/installer/templates/dbbackup-cluster.service +++ b/internal/installer/templates/dbbackup-cluster.service @@ -33,8 +33,11 @@ RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 # Environment EnvironmentFile=-/etc/dbbackup/env.d/cluster.conf +# Working directory (config is loaded from .dbbackup.conf here) +WorkingDirectory=/var/lib/dbbackup + # Execution - cluster backup (all databases) -ExecStart={{.BinaryPath}} backup cluster --config {{.ConfigPath}} +ExecStart={{.BinaryPath}} backup cluster --backup-dir {{.BackupDir}} TimeoutStartSec={{.TimeoutSeconds}} # Post-backup metrics export diff --git a/internal/installer/templates/dbbackup@.service b/internal/installer/templates/dbbackup@.service index 00d2785..5e76f9f 100644 --- a/internal/installer/templates/dbbackup@.service +++ b/internal/installer/templates/dbbackup@.service @@ -33,8 +33,11 @@ RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 # Environment EnvironmentFile=-/etc/dbbackup/env.d/%i.conf +# Working directory (config is loaded from .dbbackup.conf here) +WorkingDirectory=/var/lib/dbbackup + # Execution -ExecStart={{.BinaryPath}} backup {{.BackupType}} %i --config {{.ConfigPath}} +ExecStart={{.BinaryPath}} backup {{.BackupType}} %i --backup-dir {{.BackupDir}} TimeoutStartSec={{.TimeoutSeconds}} # Post-backup metrics export