first version
This commit is contained in:
23
dump_db.sh
Normal file
23
dump_db.sh
Normal file
@@ -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}
|
||||||
Reference in New Issue
Block a user