Move remote mediagoblin backup to app script

This commit is contained in:
Bob Mottram 2016-07-09 21:21:48 +01:00
parent 83430ecf09
commit eaa7baba88
4 changed files with 41 additions and 45 deletions

View File

@ -105,7 +105,20 @@ function restore_local_hubzilla {
} }
function backup_remote_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 { function restore_remote_hubzilla {

View File

@ -54,7 +54,20 @@ function restore_local_mediagoblin {
} }
function backup_remote_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 { function restore_remote_mediagoblin {

View File

@ -135,7 +135,18 @@ function restore_local_syncthing {
} }
function backup_remote_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 { function restore_remote_syncthing {

View File

@ -244,44 +244,6 @@ function backup_tor {
fi 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 { function backup_gogs {
export GVM_ROOT=/home/git/gvm export GVM_ROOT=/home/git/gvm
if [ -d $GVM_ROOT/bin ]; then if [ -d $GVM_ROOT/bin ]; then
@ -552,9 +514,6 @@ if [[ $TEST_MODE == "no" ]]; then
backup_admin_readme backup_admin_readme
backup_mariadb backup_mariadb
backup_hubzilla
backup_syncthing
backup_mediagoblin
backup_gogs backup_gogs
backup_wiki backup_wiki
backup_blog backup_blog