Skip to content
Snippets Groups Projects
Commit 06336167 authored by Bob Mottram's avatar Bob Mottram
Browse files

Suspend and resume for restore functions within template

parent 49a4b445
No related branches found
No related tags found
No related merge requests found
...@@ -405,11 +405,13 @@ fi ...@@ -405,11 +405,13 @@ fi
echo '}' echo '}'
echo '' echo ''
echo "function backup_local_${app_name} {" echo "function backup_local_${app_name} {"
echo " ${app_name_upper}_DOMAIN_NAME='${app_name}'" if [ $app_webui ]; then
echo " if grep -q \"${app_name} domain\" \"\$COMPLETION_FILE\"; then" echo " ${app_name_upper}_DOMAIN_NAME='${app_name}'"
echo " ${app_name_upper}_DOMAIN_NAME=\$(get_completion_param \"${app_name} domain\")" echo " if grep -q \"${app_name} domain\" \"\$COMPLETION_FILE\"; then"
echo ' fi' echo " ${app_name_upper}_DOMAIN_NAME=\$(get_completion_param \"${app_name} domain\")"
echo '' echo ' fi'
echo ''
fi
if [ ! "$app_dir" ]; then if [ ! "$app_dir" ]; then
echo " source_directory=/var/www/\${${app_name_upper}_DOMAIN_NAME}/htdocs" echo " source_directory=/var/www/\${${app_name_upper}_DOMAIN_NAME}/htdocs"
else else
...@@ -419,6 +421,10 @@ if [ $app_webui ]; then ...@@ -419,6 +421,10 @@ if [ $app_webui ]; then
echo '' echo ''
echo " suspend_site \"\${${app_name_upper}_DOMAIN_NAME}\"" echo " suspend_site \"\${${app_name_upper}_DOMAIN_NAME}\""
fi fi
if [ $app_daemon ]; then
echo ''
echo " systemctl stop ${app_name}"
fi
echo '' echo ''
echo " dest_directory=${app_name}" echo " dest_directory=${app_name}"
echo " backup_directory_to_usb \"\$source_directory\" \$dest_directory" echo " backup_directory_to_usb \"\$source_directory\" \$dest_directory"
...@@ -435,6 +441,9 @@ fi ...@@ -435,6 +441,9 @@ fi
if [ $app_webui ]; then if [ $app_webui ]; then
echo ' restart_site' echo ' restart_site'
fi fi
if [ $app_daemon ]; then
echo " systemctl start ${app_name}"
fi
echo '}' echo '}'
echo '' echo ''
echo "function restore_local_${app_name} {" echo "function restore_local_${app_name} {"
...@@ -447,6 +456,13 @@ if [ $app_webui ]; then ...@@ -447,6 +456,13 @@ if [ $app_webui ]; then
echo " return" echo " return"
echo " fi" echo " fi"
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}" echo " temp_restore_dir=/root/temp${app_name}"
if [ ! "$app_dir" ]; then if [ ! "$app_dir" ]; then
echo " ${app_name}_dir=/var/www/\${${app_name_upper}_DOMAIN_NAME}/htdocs" echo " ${app_name}_dir=/var/www/\${${app_name_upper}_DOMAIN_NAME}/htdocs"
...@@ -490,14 +506,23 @@ else ...@@ -490,14 +506,23 @@ else
fi fi
echo " rm -rf \$temp_restore_dir" echo " rm -rf \$temp_restore_dir"
echo ' fi' echo ' fi'
if [ $app_daemon ]; then
echo " systemctl start ${app_name}"
echo ''
fi
if [ $app_webui ]; then
echo ' restart_site'
fi
echo '}' echo '}'
echo '' echo ''
echo "function backup_remote_${app_name} {" echo "function backup_remote_${app_name} {"
echo " ${app_name_upper}_DOMAIN_NAME='${app_name}'" if [ $app_webui ]; then
echo " if grep -q \"${app_name} domain\" \"\$COMPLETION_FILE\"; then" echo " ${app_name_upper}_DOMAIN_NAME='${app_name}'"
echo " ${app_name_upper}_DOMAIN_NAME=\$(get_completion_param \"${app_name} domain\")" echo " if grep -q \"${app_name} domain\" \"\$COMPLETION_FILE\"; then"
echo ' fi' echo " ${app_name_upper}_DOMAIN_NAME=\$(get_completion_param \"${app_name} domain\")"
echo '' echo ' fi'
echo ''
fi
if [ ! "$app_dir" ]; then if [ ! "$app_dir" ]; then
echo " source_directory=/var/www/\${${app_name_upper}_DOMAIN_NAME}/htdocs" echo " source_directory=/var/www/\${${app_name_upper}_DOMAIN_NAME}/htdocs"
else else
...@@ -507,6 +532,9 @@ if [ $app_webui ]; then ...@@ -507,6 +532,9 @@ if [ $app_webui ]; then
echo '' echo ''
echo " suspend_site \"\${${app_name_upper}_DOMAIN_NAME}\"" echo " suspend_site \"\${${app_name_upper}_DOMAIN_NAME}\""
fi fi
if [ $app_daemon ]; then
echo " systemctl stop ${app_name}"
fi
echo '' echo ''
echo " dest_directory=${app_name}" echo " dest_directory=${app_name}"
echo " backup_directory_to_friend \"\$source_directory\" \$dest_directory" echo " backup_directory_to_friend \"\$source_directory\" \$dest_directory"
...@@ -519,6 +547,10 @@ if [[ "$database_type" == "postgres"* ]]; then ...@@ -519,6 +547,10 @@ if [[ "$database_type" == "postgres"* ]]; then
echo " backup_database_to_friend ${app_name}" echo " backup_database_to_friend ${app_name}"
echo '' echo ''
fi fi
if [ $app_daemon ]; then
echo ''
echo " systemctl start ${app_name}"
fi
if [ $app_webui ]; then if [ $app_webui ]; then
echo '' echo ''
echo ' restart_site' echo ' restart_site'
...@@ -535,6 +567,13 @@ if [ $app_webui ]; then ...@@ -535,6 +567,13 @@ if [ $app_webui ]; then
echo " return" echo " return"
echo " fi" echo " fi"
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}" echo " temp_restore_dir=/root/temp${app_name}"
if [ ! "$app_dir" ]; then if [ ! "$app_dir" ]; then
echo " ${app_name}_dir=/var/www/\${${app_name_upper}_DOMAIN_NAME}/htdocs" echo " ${app_name}_dir=/var/www/\${${app_name_upper}_DOMAIN_NAME}/htdocs"
...@@ -578,6 +617,13 @@ else ...@@ -578,6 +617,13 @@ else
fi fi
echo " rm -rf \$temp_restore_dir" echo " rm -rf \$temp_restore_dir"
echo ' fi' echo ' fi'
if [ $app_daemon ]; then
echo " systemctl start ${app_name}"
echo ''
fi
if [ $app_webui ]; then
echo ' restart_site'
fi
echo '}' echo '}'
echo '' echo ''
echo "function remove_${app_name} {" echo "function remove_${app_name} {"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment