#!/bin/bash -e

. ./xi-sys.cfg

# Was previous step completed?
if [ ! -f installed.selinux ]; then
	echo "SELinux was not configured - run previous script" >&2
	exit 1
fi

# Was this step already completed?
if [ -f installed.dbbackups ]; then
	echo "Database backups already configured - skipping."
	exit 0
fi

mkdir -p /store/backups/mysql /store/backups/nagiosxi /root/scripts
chown "$nagiosuser:$nagiosgroup" -R /store/backups/nagiosxi
cp nagiosxi/automysqlbackup /root/scripts

echo "Database backups configured OK"
touch installed.dbbackups

