You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
559 B

backuppath='/srv/backUP/lxc/'
backupuser='rick-monitoring'
lxccmd='/snap/bin/lxc'
dbname='iq_cloud'
#some validations
if [ ! -d ${backuppath} ]
then
echo "Please set a backup directory which is accessible by this script"
exit 2
fi
id $backupuser > /dev/null 2>&1
if [ $? -ne 0 ]
then
echo "Please set a valid user within this script"
exit 2
fi
# BackUP nc_database
${lxccmd} exec nc-1 -- sh -c "mysqldump --single-transaction ${dbname}" | gzip -9 > ${backuppath}$(date +%Y_%m_%d)_nc_mysql.dump.gz
chown -R ${backupuser}:${backupuser} ${backuppath}