bundles/backup-client: do logging
All checks were successful
bundlewrap/pipeline/head This commit looks good

This commit is contained in:
Franzi 2021-06-06 08:05:41 +02:00
parent 3fc51d9eba
commit fa4fe51155
Signed by: kunsi
GPG key ID: 12E3D2136B818350
3 changed files with 17 additions and 1 deletions

View file

@ -0,0 +1,10 @@
/var/log/backup-client/*.log {
compress
copytruncate
daily
dateext
missingok
notifempty
rotate 14
sharedscripts
}

View file

@ -47,10 +47,16 @@ files['/usr/local/share/icinga/plugins/check_backup_last_run'] = {
'mode': '0755', 'mode': '0755',
} }
files['/etc/logrotate.d/backup-client'] = {
'source': 'logrotate.conf',
}
directories['/etc/backup-pre-hooks.d'] = { directories['/etc/backup-pre-hooks.d'] = {
'purge': True, 'purge': True,
} }
directories['/var/log/backup-client'] = {}
for hname, hcontent in node.metadata.get('backup-client/pre-hooks', {}).items(): for hname, hcontent in node.metadata.get('backup-client/pre-hooks', {}).items():
files[f'/etc/backup-pre-hooks.d/50-{hname}'] = { files[f'/etc/backup-pre-hooks.d/50-{hname}'] = {
'content': '#!/bin/sh\n\n' + hcontent, 'content': '#!/bin/sh\n\n' + hcontent,

View file

@ -19,7 +19,7 @@ def cron(metadata):
return { return {
'cron': { 'cron': {
'backup': '{} 23 * * * root /usr/local/bin/generate-backup > /dev/null 2>&1'.format( 'backup': '{} 23 * * * root /usr/local/bin/generate-backup > /var/log/backup-client/backup.log 2>&1'.format(
(node.magic_number % 60), (node.magic_number % 60),
), ),
}, },