From eaa7baba882252305ada13a78104743afa2bff59 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 9 Jul 2016 21:21:48 +0100 Subject: [PATCH] Move remote mediagoblin backup to app script --- src/freedombone-app-hubzilla | 17 ++++++++++++-- src/freedombone-app-mediagoblin | 15 +++++++++++- src/freedombone-app-syncthing | 13 ++++++++++- src/freedombone-backup-remote | 41 --------------------------------- 4 files changed, 41 insertions(+), 45 deletions(-) diff --git a/src/freedombone-app-hubzilla b/src/freedombone-app-hubzilla index 4b343f45..b07902db 100755 --- a/src/freedombone-app-hubzilla +++ b/src/freedombone-app-hubzilla @@ -41,7 +41,7 @@ HUBZILLA_COMMIT='2d79e75788aa71664a379c4cea0b6bfe3ab87ad0' HUBZILLA_ADDONS_COMMIT='67b40c7a40f328a93ee030eb15e9e1261f3cba64' function reconfigure_hubzilla { - echo -n '' + echo -n '' } function upgrade_hubzilla { @@ -105,7 +105,20 @@ function restore_local_hubzilla { } function backup_remote_hubzilla { - echo -n '' + if grep -q "Hubzilla domain" $COMPLETION_FILE; then + HUBZILLA_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Hubzilla domain" | awk -F ':' '{print $2}') + temp_backup_dir=/var/www/${HUBZILLA_DOMAIN_NAME}/htdocs + if [ -d $temp_backup_dir ]; then + suspend_site ${HUBZILLA_DOMAIN_NAME} + backup_database_to_friend hubzilla + echo "Backing up Hubzilla installation" + backup_directory_to_friend $temp_backup_dir hubzilla + restart_site + else + echo $"Hubzilla domain specified but not found in /var/www/${HUBZILLA_DOMAIN_NAME}" + exit 2578 + fi + fi } function restore_remote_hubzilla { diff --git a/src/freedombone-app-mediagoblin b/src/freedombone-app-mediagoblin index 2c4c505e..ed217884 100755 --- a/src/freedombone-app-mediagoblin +++ b/src/freedombone-app-mediagoblin @@ -54,7 +54,20 @@ function restore_local_mediagoblin { } function backup_remote_mediagoblin { - echo -n '' + if grep -q "Mediagoblin domain" $COMPLETION_FILE; then + MEDIAGOBLIN_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Mediagoblin domain" | awk -F ':' '{print $2}') + function_check suspend_site + suspend_site ${MEDIAGOBLIN_DOMAIN_NAME} + + echo $"Backing up Mediagoblin" + + backup_directory_to_friend /var/www/$MEDIAGOBLIN_DOMAIN_NAME/htdocs mediagoblin + + function_check restart_site + restart_site + + echo $"Backup of Mediagoblin complete" + fi } function restore_remote_mediagoblin { diff --git a/src/freedombone-app-syncthing b/src/freedombone-app-syncthing index d665e8ee..9fb89fe2 100755 --- a/src/freedombone-app-syncthing +++ b/src/freedombone-app-syncthing @@ -135,7 +135,18 @@ function restore_local_syncthing { } function backup_remote_syncthing { - echo -n '' + if [ -d /root/.config/syncthing ]; then + echo $"Backing up syncthing configuration" + function_check backup_directory_to_friend + backup_directory_to_friend /root/.config/syncthing syncthingconfig + echo $"Backup of syncthing configuration complete" + fi + if [ -d /var/lib/syncthing/SyncShared ]; then + echo $"Backing up syncthing shared files" + function_check backup_directory_to_friend + backup_directory_to_friend /var/lib/syncthing/SyncShared syncthingshared + echo $"Backup of syncthing shared files complete" + fi } function restore_remote_syncthing { diff --git a/src/freedombone-backup-remote b/src/freedombone-backup-remote index fc9ce845..3d7edead 100755 --- a/src/freedombone-backup-remote +++ b/src/freedombone-backup-remote @@ -244,44 +244,6 @@ function backup_tor { fi } -function backup_hubzilla { - if grep -q "Hubzilla domain" $COMPLETION_FILE; then - HUBZILLA_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Hubzilla domain" | awk -F ':' '{print $2}') - if [ -d /var/www/${HUBZILLA_DOMAIN_NAME} ]; then - suspend_site ${HUBZILLA_DOMAIN_NAME} - backup_database_to_friend hubzilla - backup_directory_to_friend /root/temphubzilladata hubzilladata - echo "Backing up Hubzilla installation" - backup_directory_to_friend /var/www/${HUBZILLA_DOMAIN_NAME}/htdocs hubzilla - restart_site - else - echo $"Hubzilla domain specified but not found in /var/www/${HUBZILLA_DOMAIN_NAME}" - exit 2578 - fi - fi -} - -function backup_syncthing { - if [ -d /root/.config/syncthing ]; then - echo $"Backing up syncthing configuration" - backup_directory_to_friend /root/.config/syncthing syncthingconfig - fi - if [ -d /var/lib/syncthing/SyncShared ]; then - echo $"Backing up syncthing shared files" - backup_directory_to_friend /var/lib/syncthing/SyncShared syncthingshared - fi -} - -function backup_mediagoblin { - if grep -q "Mediagoblin domain" $COMPLETION_FILE; then - MEDIAGOBLIN_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Mediagoblin domain" | awk -F ':' '{print $2}') - suspend_site ${MEDIAGOBLIN_DOMAIN_NAME} - echo $"Backing up Mediagoblin" - backup_directory_to_friend /var/www/$MEDIAGOBLIN_DOMAIN_NAME/htdocs mediagoblin - restart_site - fi -} - function backup_gogs { export GVM_ROOT=/home/git/gvm if [ -d $GVM_ROOT/bin ]; then @@ -552,9 +514,6 @@ if [[ $TEST_MODE == "no" ]]; then backup_admin_readme backup_mariadb - backup_hubzilla - backup_syncthing - backup_mediagoblin backup_gogs backup_wiki backup_blog