Skip to content

Commit

Permalink
add daily cron job and logrotate for backup status report csv
Browse files Browse the repository at this point in the history
  • Loading branch information
bdzim committed Mar 30, 2018
1 parent c92f07e commit 4929eb6
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 3 deletions.
8 changes: 8 additions & 0 deletions bin/backup_status.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
# Create backup status csv

. /etc/default/openmanage

pushd $OPENMANAGE_DJANGO_ROOT/omva
python manage.py backupstatus
popd
2 changes: 1 addition & 1 deletion deploy/make_tarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ mkdir $buildit_dir/sql
cp $source_dir/sql/*.sql $buildit_dir/sql

# Package the configuration files.
included_management="openmanage_defaults apt_list py_list agent_config.json.sample nginx_vhost crontab log_rotate_directory_agent"
included_management="openmanage_defaults apt_list py_list agent_config.json.sample nginx_vhost crontab log_rotate_directory_agent log_rotate_backup_status"
for file in $included_management; do
cp $source_dir/etc/$file $buildit_dir/etc
done
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def add_arguments(self, parser):
parser.add_argument('-b', '--backed-up-within', default=90, type=int)
parser.add_argument('-n', '--not-backed-up-within', default=3, type=int)
parser.add_argument(
'-o', '--outdir', default='/home/openmanage/backup_status', type=str
'-o', '--outdir', default='/var/log/omva/backup_status', type=str
)

def _backed_up_within(self, last_backup_complete, backed_up_within):
Expand Down
1 change: 0 additions & 1 deletion django/apps/blue_management/blue_mgnt/views/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,6 @@ def users_csv_download(request, api, account_info, config, username):

class ReadOnlyWidget(forms.Widget):
def render(self, name, value, attrs):
self.build_attrs(attrs, name=name)
if hasattr(self, 'initial'):
value = self.initial
return "%s" % (value if value is not None else '')
Expand Down
8 changes: 8 additions & 0 deletions etc/log_rotate_backup_status
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/var/log/omva/backup_status/*.csv {
daily
maxage 7
rotate 7
nocompress
missingok
notifempty
}
10 changes: 10 additions & 0 deletions upgrade/scripts/2017-03-30_backup_status.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# Symlink logrotate config and run backup status daily

. /etc/default/openmanage

mkdir -p /var/log/omva/backup_status

sudo ln -s $OPENMANAGE_ROOT/etc/log_rotate_backup_status /etc/logrotate.d/backup_status
sudo ln -s $OPENMANAGE_ROOT/bin/backup_status.sh /etc/cron.daily/backup_status

0 comments on commit 4929eb6

Please sign in to comment.