Browse Source

updated messages

bugfixes
harshadyeola 10 years ago
parent
commit
3fd9e2ff7c
  1. 12
      src/modules/site/ee_mod_site_backup.sh
  2. 2
      src/modules/site/update/ee_mod_update_domain.sh

12
src/modules/site/ee_mod_site_backup.sh

@ -5,26 +5,26 @@ function ee_mod_site_backup()
# Backup directory setup # Backup directory setup
local ee_webroot=$(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/\/htdocs//') local ee_webroot=$(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/\/htdocs//')
if [ ! -d $ee_webroot/backup ] || [ ! -d $ee_webroot/backup/htdocs/$EE_DATE ] || [ ! -d $ee_webroot/backup/nginx ] || [ ! -d $ee_webroot/backup/db ]; then if [ ! -d $ee_webroot/backup ] || [ ! -d $ee_webroot/backup/htdocs/$EE_DATE ] || [ ! -d $ee_webroot/backup/nginx/$EE_DATE ] || [ ! -d $ee_webroot/backup/db/$EE_DATE ]; then
mkdir -p $ee_webroot/backup/{htdocs/$EE_DATE,nginx,db} || ee_lib_error "Unable to create $ee_webroot/backup directory, exit status =" $? mkdir -p $ee_webroot/backup/{htdocs/$EE_DATE,nginx,db} || ee_lib_error "Unable to create $ee_webroot/backup directory, exit status =" $?
fi fi
# Move htdocs # Move htdocs
if [ "$EE_SITE_CURRENT_OPTION" = "HTML" ] || [ "$EE_SITE_CURRENT_OPTION" = "MYSQL" ] || [ "$EE_SITE_CURRENT_OPTION" = "PHP" ]; then if [ "$EE_SITE_CURRENT_OPTION" = "HTML" ] || [ "$EE_SITE_CURRENT_OPTION" = "MYSQL" ] || [ "$EE_SITE_CURRENT_OPTION" = "PHP" ]; then
ee_lib_echo "Creating Webroot backup for $EE_DOMAIN, please wait..." ee_lib_echo "Backup webroot at $ee_webroot/backup/htdocs/$EE_DATE/, please wait..."
mv $ee_webroot/htdocs $ee_webroot/backup/htdocs/$EE_DATE/ || ee_lib_error "Unable to move $ee_webroot/htdocs to backup, exit status =" $? mv $ee_webroot/htdocs $ee_webroot/backup/htdocs/$EE_DATE/ || ee_lib_error "Unable to move $ee_webroot/htdocs to backup, exit status =" $?
mkdir -p $ee_webroot/htdocs mkdir -p $ee_webroot/htdocs
fi fi
ee_lib_echo "Creating NGINX configuration backup for $EE_DOMAIN, please wait..." ee_lib_echo "Backup NGINX configuration at $ee_webroot/backup/nginx/$EE_DATE/, please wait..."
# Backup $EE_DOMAIN NGINX configuration # Backup $EE_DOMAIN NGINX configuration
cp /etc/nginx/sites-available/$EE_DOMAIN $ee_webroot/backup/nginx/${EE_DOMAIN}-$EE_DATE.conf &>> $EE_COMMAND_LOG cp /etc/nginx/sites-available/$EE_DOMAIN $ee_webroot/backup/nginx/$EE_DATE/ &>> $EE_COMMAND_LOG
# Database backup # Database backup
if [ -f $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/htdocs/*-config.php/') ]; then if [ -f $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/htdocs/*-config.php/') ]; then
ee_lib_echo "Creating Database backup for $EE_DOMAIN, please wait..."
local ee_db_name=$(grep DB_NAME $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/htdocs/*-config.php/' 2> /dev/null) | cut -d"'" -f4) local ee_db_name=$(grep DB_NAME $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/htdocs/*-config.php/' 2> /dev/null) | cut -d"'" -f4)
mysqldump $ee_db_name > $ee_webroot/backup/db/${ee_db_name}-$EE_DATE.sql \ ee_lib_echo "Backup Database $ee_db_name at $ee_webroot/backup/db/$EE_DATE/, please wait..."
mysqldump $ee_db_name > $ee_webroot/backup/db/$EE_DATE/${ee_db_name}.sql \
|| ee_lib_error "Unable to dump ${ee_db_name}, exit status =" $? || ee_lib_error "Unable to dump ${ee_db_name}, exit status =" $?
# Move ee-config.php and copy wp-config.php to backup # Move ee-config.php and copy wp-config.php to backup

2
src/modules/site/update/ee_mod_update_domain.sh

@ -8,7 +8,7 @@ function ee_mod_update_domain()
ee_mod_site_backup ee_mod_site_backup
# Creating $EE_DOMAIN # Creating $EE_DOMAIN
ee_lib_echo "Updating $EE_DOMAIN, please wait ..." ee_lib_echo "Updating $EE_DOMAIN, please wait..."
if [ -f /etc/nginx/sites-available/$EE_DOMAIN ]; then if [ -f /etc/nginx/sites-available/$EE_DOMAIN ]; then
EE_SITE_CURRENT_CONF=$(head -n1 /etc/nginx/sites-available/$EE_DOMAIN | grep "NGINX CONFIGURATION") EE_SITE_CURRENT_CONF=$(head -n1 /etc/nginx/sites-available/$EE_DOMAIN | grep "NGINX CONFIGURATION")
EE_SITE_UPDATE_CONF=$(head -n1 /usr/share/easyengine/nginx/$EE_NGINX_CONF | grep "NGINX CONFIGURATION") EE_SITE_UPDATE_CONF=$(head -n1 /usr/share/easyengine/nginx/$EE_NGINX_CONF | grep "NGINX CONFIGURATION")

Loading…
Cancel
Save