Browse Source

date format updated and output to log file

bugfixes
harshadyeola 10 years ago
parent
commit
d576326c5e
  1. 6
      src/modules/site/ee_mod_site_backup.sh

6
src/modules/site/ee_mod_site_backup.sh

@ -10,16 +10,16 @@ function ee_mod_site_backup()
# Move htdocs
if [ "$EE_SITE_CURRENT_OPTION" = "HTML" ] || [ "$EE_SITE_CURRENT_OPTION" = "MYSQL" ] || [ "$EE_SITE_CURRENT_OPTION" = "PHP" ]; then
mv $ee_webroot/htdocs $ee_webroot/backup/htdocs/htdocs-$(date +"%m-%d-%y:") || ee_lib_error "Unable to create $ee_webroot/htdocs backup, exit status =" $?
mv $ee_webroot/htdocs $ee_webroot/backup/htdocs/htdocs-$(date +"%m-%d-%y::%T") || ee_lib_error "Unable to create $ee_webroot/htdocs backup, exit status =" $?
mkdir -p $ee_webroot/htdocs
fi
# Backup $EE_DOMAIN NGINX configuration
cp -av /etc/nginx/sites-available/$EE_DOMAIN $ee_webroot/backup/nginx/${EE_DOMAIN}-$(date +"%m-%d-%y").conf.bak
cp -av /etc/nginx/sites-available/$EE_DOMAIN $ee_webroot/backup/nginx/${EE_DOMAIN}-$(date +"%m-%d-%y::%T").conf.bak &>> $EE_COMMAND_LOG
# Database backup
if [ -f $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/htdocs/*-config.php/') ]; then
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}-$(date +"%m-%d-%y").sql.bak
mysqldump $ee_db_name > $ee_webroot/backup/db/${ee_db_name}-$(date +"%m-%d-%y::%T").sql.bak &>> $EE_COMMAND_LOG
fi
}

Loading…
Cancel
Save