commit 0915118f448cf0854d7784a6576fef2dd04be1ad Author: rick Date: Mon Jun 7 22:45:21 2021 +0200 first version diff --git a/dump_db.sh b/dump_db.sh new file mode 100644 index 0000000..68021be --- /dev/null +++ b/dump_db.sh @@ -0,0 +1,23 @@ +backuppath='/srv/backUP/sharelatex/' +backupuser='rick-monitoring' +lxccmd='/snap/bin/lxc' + +#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 iq_cloud' | gzip -9 > ${backuppath}$(date +%Y_%m_%d)_nc_mysql.dumb.gz + + +chown -R ${backupuser}:${backupuser} ${backuppath}