Backup and restore synapse data

This commit is contained in:
Bob Mottram 2016-11-07 14:26:34 +00:00
parent 54fe76b9d3
commit 0ee06e5581
1 changed files with 29 additions and 1 deletions

View File

@ -88,6 +88,10 @@ function backup_local_synapse {
systemctl stop synapse
function_check backup_directory_to_usb
backup_directory_to_usb $source_directory synapse
source_directory=/var/lib/matrix-synapse
if [ -d $source_directory ]; then
backup_directory_to_usb $source_directory synapsedata
fi
systemctl start synapse
fi
}
@ -108,6 +112,17 @@ function restore_local_synapse {
rm -rf $temp_restore_dir
chown -R synapse:synapse $SYNAPSE_DIR
temp_restore_dir=/root/tempsynapsedata
restore_directory_from_usb $temp_restore_dir synapsedata
cp -r $temp_restore_dir/var/lib/matrix-synapse/* /var/lib/matrix-synapse
if [ ! "$?" = "0" ]; then
function_check backup_unmount_drive
backup_unmount_drive
exit 36872
fi
rm -rf $temp_restore_dir
chown -R synapse:synapse /var/lib/matrix-synapse
systemctl start synapse
fi
}
@ -118,6 +133,10 @@ function backup_remote_synapse {
systemctl stop synapse
function_check backup_directory_to_friend
backup_directory_to_friend $source_directory synapse
source_directory=/var/lib/matrix-synapse
if [ -d $source_directory ]; then
backup_directory_to_friend $source_directory synapsedata
fi
systemctl start synapse
fi
}
@ -131,11 +150,20 @@ function restore_remote_synapse {
restore_directory_from_friend $temp_restore_dir synapse
cp -r $temp_restore_dir$SYNAPSE_DIR/* $SYNAPSE_DIR
if [ ! "$?" = "0" ]; then
exit 725
exit 59262
fi
rm -rf $temp_restore_dir
chown -R synapse:synapse $SYNAPSE_DIR
temp_restore_dir=/root/tempsynapsedata
restore_directory_from_friend $temp_restore_dir synapsedata
cp -r $temp_restore_dir/var/lib/matrix-synapse/* /var/lib/matrix-synapse
if [ ! "$?" = "0" ]; then
exit 78335
fi
rm -rf $temp_restore_dir
chown -R synapse:synapse /var/lib/matrix-synapse
systemctl start synapse
fi
}