#!/bin/bash

/usr/local/bin/automysqlbackup $1 $2 >/dev/null

DB=$(/sbin/e-smith/db configuration getprop automysqlbackup Backupdir)

if [ -z "$DB" ]; then
    DB="/root/backup/db";
fi

if [[ "$DB" =~ "^/root/backup" ]] || [[ "$DB" =~ "^/home/e-smith/db/" ]] ; then
    chown root:root $DB$2 -R
    find $DB$2 -type f -exec chmod 400 {} \;
    find $DB$2 -type d -exec chmod 700 {} \;
fi
