Tidying
This commit is contained in:
parent
6138e2358a
commit
313fb432d3
|
@ -475,19 +475,20 @@ function restore_database_from_friend {
|
|||
|
||||
if [ -d $SERVER_DIRECTORY/backup/${1} ]; then
|
||||
echo $"Restoring ${1} database"
|
||||
restore_directory_from_friend /root/temp${1}data ${1}data
|
||||
if [ ! -f /root/temp${1}data/${RESTORE_SUBDIR}/temp${1}data/${1}.sql ]; then
|
||||
local_database_dir=/root/temp${1}data
|
||||
restore_directory_from_friend ${local_database_dir} ${1}data
|
||||
if [ ! -f ${local_database_dir}/${RESTORE_SUBDIR}/temp${1}data/${1}.sql ]; then
|
||||
echo $"Unable to restore ${1} database"
|
||||
rm -rf /root/temp${1}data
|
||||
rm -rf ${local_database_dir}
|
||||
exit 503
|
||||
fi
|
||||
mysqlsuccess=$(mysql -u root --password="$DATABASE_PASSWORD" ${1} -o < /root/temp${1}data/${RESTORE_SUBDIR}/temp${1}data/${1}.sql)
|
||||
mysqlsuccess=$(mysql -u root --password="$DATABASE_PASSWORD" ${1} -o < ${local_database_dir}/${RESTORE_SUBDIR}/temp${1}data/${1}.sql)
|
||||
if [ ! "$?" = "0" ]; then
|
||||
echo "$mysqlsuccess"
|
||||
exit 964
|
||||
fi
|
||||
shred -zu /root/temp${1}data/${RESTORE_SUBDIR}/temp${1}data/*
|
||||
rm -rf /root/temp${1}data
|
||||
shred -zu ${local_database_dir}/${RESTORE_SUBDIR}/temp${1}data/*
|
||||
rm -rf ${local_database_dir}
|
||||
echo $"Restoring ${1} installation"
|
||||
restore_directory_from_friend /root/temp${1} ${1}
|
||||
RESTORE_SUBDIR="var"
|
||||
|
@ -519,18 +520,19 @@ function restore_database {
|
|||
|
||||
if [ -d $USB_MOUNT/backup/${1} ]; then
|
||||
echo $"Restoring ${1} database"
|
||||
local_database_dir=/root/temp${1}data
|
||||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb "/root/temp${1}data" "${1}data"
|
||||
restore_directory_from_usb "${local_database}" "${1}data"
|
||||
if [ ! -f /root/temp${1}data/${RESTORE_SUBDIR}/temp${1}data/${1}.sql ]; then
|
||||
echo $"Unable to restore ${1} database"
|
||||
rm -rf /root/temp${1}data
|
||||
rm -rf ${local_database}
|
||||
function_check set_user_permissions
|
||||
set_user_permissions
|
||||
function_check backup_unmount_drive
|
||||
backup_unmount_drive
|
||||
exit 503
|
||||
fi
|
||||
mysqlsuccess=$(mysql -u root --password="$DATABASE_PASSWORD" ${1} -o < /root/temp${1}data/${RESTORE_SUBDIR}/temp${1}data/${1}.sql)
|
||||
mysqlsuccess=$(mysql -u root --password="$DATABASE_PASSWORD" ${1} -o < ${local_database}/${RESTORE_SUBDIR}/temp${1}data/${1}.sql)
|
||||
if [ ! "$?" = "0" ]; then
|
||||
echo "$mysqlsuccess"
|
||||
function_check set_user_permissions
|
||||
|
@ -539,8 +541,8 @@ function restore_database {
|
|||
backup_unmount_drive
|
||||
exit 964
|
||||
fi
|
||||
shred -zu /root/temp${1}data/${RESTORE_SUBDIR}/temp${1}data/*
|
||||
rm -rf /root/temp${1}data
|
||||
shred -zu ${local_database}/${RESTORE_SUBDIR}/temp${1}data/*
|
||||
rm -rf ${local_database}
|
||||
echo $"Restoring ${1} installation"
|
||||
if [ ! -d /root/temp${1} ]; then
|
||||
mkdir /root/temp${1}
|
||||
|
|
Loading…
Reference in New Issue