Restore domain directories
This commit is contained in:
parent
690906fc23
commit
fe2efe6bb4
|
@ -513,6 +513,11 @@ function restore_database_from_friend {
|
|||
restore_directory_from_friend /root/temp${1} ${1}
|
||||
RESTORE_SUBDIR="var"
|
||||
if [ ${1} ]; then
|
||||
if [ ! -d /var/www/${2}/htdocs ]; then
|
||||
mkdir -p /var/www/${2}/htdocs
|
||||
chown www-data:www-data /var/www/${2}/htdocs
|
||||
fi
|
||||
|
||||
if [ -d /var/www/${2}/htdocs ]; then
|
||||
if [ -d /root/temp${1}/${RESTORE_SUBDIR}/www/${2}/htdocs ]; then
|
||||
rm -rf /var/www/${2}/htdocs
|
||||
|
@ -538,7 +543,7 @@ function restore_database_from_friend {
|
|||
function restore_database {
|
||||
RESTORE_SUBDIR="root"
|
||||
restore_app_name=$1
|
||||
restore_app_dir=$2
|
||||
restore_app_domain=$2
|
||||
|
||||
if [ -d $USB_MOUNT/backup/${restore_app_name} ]; then
|
||||
echo $"Restoring ${restore_app_name} database"
|
||||
|
@ -572,23 +577,27 @@ function restore_database {
|
|||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb "/root/temp${restore_app_name}" "${restore_app_name}"
|
||||
RESTORE_SUBDIR="var"
|
||||
if [ ${restore_app_dir} ]; then
|
||||
if [ -d /var/www/${restore_app_dir}/htdocs ]; then
|
||||
if [ -d /root/temp${restore_app_name}/${RESTORE_SUBDIR}/www/${restore_app_dir}/htdocs ]; then
|
||||
rm -rf /var/www/${restore_app_dir}/htdocs
|
||||
mv /root/temp${restore_app_name}/${RESTORE_SUBDIR}/www/${restore_app_dir}/htdocs /var/www/${restore_app_dir}/
|
||||
if [ ${restore_app_domain} ]; then
|
||||
if [ ! -d /var/www/${restore_app_domain}/htdocs ]; then
|
||||
mkdir -p /var/www/${restore_app_domain}/htdocs
|
||||
chown www-data:www-data /var/www/${restore_app_domain}/htdocs
|
||||
fi
|
||||
if [ -d /var/www/${restore_app_domain}/htdocs ]; then
|
||||
if [ -d /root/temp${restore_app_name}/${RESTORE_SUBDIR}/www/${restore_app_domain}/htdocs ]; then
|
||||
rm -rf /var/www/${restore_app_domain}/htdocs
|
||||
mv /root/temp${restore_app_name}/${RESTORE_SUBDIR}/www/${restore_app_domain}/htdocs /var/www/${restore_app_domain}/
|
||||
if [ ! "$?" = "0" ]; then
|
||||
set_user_permissions
|
||||
backup_unmount_drive
|
||||
exit 683
|
||||
fi
|
||||
if [ -d /etc/letsencrypt/live/${restore_app_dir} ]; then
|
||||
ln -s /etc/letsencrypt/live/${restore_app_dir}/privkey.pem /etc/ssl/private/${restore_app_dir}.key
|
||||
ln -s /etc/letsencrypt/live/${restore_app_dir}/fullchain.pem /etc/ssl/certs/${restore_app_dir}.pem
|
||||
if [ -d /etc/letsencrypt/live/${restore_app_domain} ]; then
|
||||
ln -s /etc/letsencrypt/live/${restore_app_domain}/privkey.pem /etc/ssl/private/${restore_app_domain}.key
|
||||
ln -s /etc/letsencrypt/live/${restore_app_domain}/fullchain.pem /etc/ssl/certs/${restore_app_domain}.pem
|
||||
else
|
||||
# Ensure that the bundled SSL cert is being used
|
||||
if [ -f /etc/ssl/certs/${restore_app_dir}.bundle.crt ]; then
|
||||
sed -i "s|${restore_app_dir}.crt|${restore_app_dir}.bundle.crt|g" /etc/nginx/sites-available/${restore_app_dir}
|
||||
if [ -f /etc/ssl/certs/${restore_app_domain}.bundle.crt ]; then
|
||||
sed -i "s|${restore_app_domain}.crt|${restore_app_domain}.bundle.crt|g" /etc/nginx/sites-available/${restore_app_domain}
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue