Suspend and resume for restore functions within template

This commit is contained in:
Bob Mottram 2018-04-08 17:45:31 +01:00
parent 49a4b445f7
commit 06336167a3
1 changed files with 56 additions and 10 deletions

View File

@ -405,11 +405,13 @@ fi
echo '}'
echo ''
echo "function backup_local_${app_name} {"
echo " ${app_name_upper}_DOMAIN_NAME='${app_name}'"
echo " if grep -q \"${app_name} domain\" \"\$COMPLETION_FILE\"; then"
echo " ${app_name_upper}_DOMAIN_NAME=\$(get_completion_param \"${app_name} domain\")"
echo ' fi'
echo ''
if [ $app_webui ]; then
echo " ${app_name_upper}_DOMAIN_NAME='${app_name}'"
echo " if grep -q \"${app_name} domain\" \"\$COMPLETION_FILE\"; then"
echo " ${app_name_upper}_DOMAIN_NAME=\$(get_completion_param \"${app_name} domain\")"
echo ' fi'
echo ''
fi
if [ ! "$app_dir" ]; then
echo " source_directory=/var/www/\${${app_name_upper}_DOMAIN_NAME}/htdocs"
else
@ -419,6 +421,10 @@ if [ $app_webui ]; then
echo ''
echo " suspend_site \"\${${app_name_upper}_DOMAIN_NAME}\""
fi
if [ $app_daemon ]; then
echo ''
echo " systemctl stop ${app_name}"
fi
echo ''
echo " dest_directory=${app_name}"
echo " backup_directory_to_usb \"\$source_directory\" \$dest_directory"
@ -435,6 +441,9 @@ fi
if [ $app_webui ]; then
echo ' restart_site'
fi
if [ $app_daemon ]; then
echo " systemctl start ${app_name}"
fi
echo '}'
echo ''
echo "function restore_local_${app_name} {"
@ -447,6 +456,13 @@ if [ $app_webui ]; then
echo " return"
echo " fi"
fi
if [ $app_webui ]; then
echo " suspend_site \"\${${app_name_upper}_DOMAIN_NAME}\""
fi
if [ $app_daemon ]; then
echo " systemctl stop ${app_name}"
echo ''
fi
echo " temp_restore_dir=/root/temp${app_name}"
if [ ! "$app_dir" ]; then
echo " ${app_name}_dir=/var/www/\${${app_name_upper}_DOMAIN_NAME}/htdocs"
@ -490,14 +506,23 @@ else
fi
echo " rm -rf \$temp_restore_dir"
echo ' fi'
if [ $app_daemon ]; then
echo " systemctl start ${app_name}"
echo ''
fi
if [ $app_webui ]; then
echo ' restart_site'
fi
echo '}'
echo ''
echo "function backup_remote_${app_name} {"
echo " ${app_name_upper}_DOMAIN_NAME='${app_name}'"
echo " if grep -q \"${app_name} domain\" \"\$COMPLETION_FILE\"; then"
echo " ${app_name_upper}_DOMAIN_NAME=\$(get_completion_param \"${app_name} domain\")"
echo ' fi'
echo ''
if [ $app_webui ]; then
echo " ${app_name_upper}_DOMAIN_NAME='${app_name}'"
echo " if grep -q \"${app_name} domain\" \"\$COMPLETION_FILE\"; then"
echo " ${app_name_upper}_DOMAIN_NAME=\$(get_completion_param \"${app_name} domain\")"
echo ' fi'
echo ''
fi
if [ ! "$app_dir" ]; then
echo " source_directory=/var/www/\${${app_name_upper}_DOMAIN_NAME}/htdocs"
else
@ -507,6 +532,9 @@ if [ $app_webui ]; then
echo ''
echo " suspend_site \"\${${app_name_upper}_DOMAIN_NAME}\""
fi
if [ $app_daemon ]; then
echo " systemctl stop ${app_name}"
fi
echo ''
echo " dest_directory=${app_name}"
echo " backup_directory_to_friend \"\$source_directory\" \$dest_directory"
@ -519,6 +547,10 @@ if [[ "$database_type" == "postgres"* ]]; then
echo " backup_database_to_friend ${app_name}"
echo ''
fi
if [ $app_daemon ]; then
echo ''
echo " systemctl start ${app_name}"
fi
if [ $app_webui ]; then
echo ''
echo ' restart_site'
@ -535,6 +567,13 @@ if [ $app_webui ]; then
echo " return"
echo " fi"
fi
if [ $app_webui ]; then
echo " suspend_site \"\${${app_name_upper}_DOMAIN_NAME}\""
fi
if [ $app_daemon ]; then
echo " systemctl stop ${app_name}"
echo ''
fi
echo " temp_restore_dir=/root/temp${app_name}"
if [ ! "$app_dir" ]; then
echo " ${app_name}_dir=/var/www/\${${app_name_upper}_DOMAIN_NAME}/htdocs"
@ -578,6 +617,13 @@ else
fi
echo " rm -rf \$temp_restore_dir"
echo ' fi'
if [ $app_daemon ]; then
echo " systemctl start ${app_name}"
echo ''
fi
if [ $app_webui ]; then
echo ' restart_site'
fi
echo '}'
echo ''
echo "function remove_${app_name} {"