From 2f4775ba681526a983d42f0675e6b2e006861a92 Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Wed, 26 Apr 2023 21:24:16 +0000 Subject: [PATCH] wal-g: Write out a logfile. Otherwise, this output goes into `/var/spool/mail/postgres`, which is not terribly helpful. We do not write to `/var/log/zulip` because the backup runs as the `postgres` user, and `/var/log/zulip` is owned by zulip and chmod 750. --- puppet/zulip/files/cron.d/pg-backup-and-purge | 2 +- puppet/zulip/manifests/postgresql_backups.pp | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/puppet/zulip/files/cron.d/pg-backup-and-purge b/puppet/zulip/files/cron.d/pg-backup-and-purge index ba186c2c29..dcf077962e 100644 --- a/puppet/zulip/files/cron.d/pg-backup-and-purge +++ b/puppet/zulip/files/cron.d/pg-backup-and-purge @@ -1,3 +1,3 @@ PATH=/bin:/usr/bin:/usr/local/bin -0 2 * * * postgres /usr/local/bin/pg_backup_and_purge +0 2 * * * postgres /usr/local/bin/pg_backup_and_purge >/var/log/pg_backup_and_purge.log 2>&1 diff --git a/puppet/zulip/manifests/postgresql_backups.pp b/puppet/zulip/manifests/postgresql_backups.pp index 52d7396c54..80153cb41e 100644 --- a/puppet/zulip/manifests/postgresql_backups.pp +++ b/puppet/zulip/manifests/postgresql_backups.pp @@ -4,6 +4,12 @@ class zulip::postgresql_backups { include zulip::postgresql_common include zulip::wal_g + file { '/var/log/pg_backup_and_purge.log': + ensure => file, + owner => 'postgres', + group => 'postgres', + mode => '0644', + } file { '/usr/local/bin/pg_backup_and_purge': ensure => file, owner => 'root', @@ -38,7 +44,10 @@ class zulip::postgresql_backups { group => 'root', mode => '0644', source => 'puppet:///modules/zulip/cron.d/pg-backup-and-purge', - require => File['/usr/local/bin/pg_backup_and_purge'], + require => [ + File['/var/log/pg_backup_and_purge.log'], + File['/usr/local/bin/pg_backup_and_purge'], + ], } file { "${zulip::common::nagios_plugins_dir}/zulip_postgresql_backups":