Backup and restore matrix identity server

This commit is contained in:
Bob Mottram 2016-12-31 15:57:36 +00:00
parent 347a172822
commit a0972bab26
1 changed files with 28 additions and 0 deletions

View File

@ -342,6 +342,10 @@ function backup_local_matrix {
if [ -d $source_directory ]; then
backup_directory_to_usb $source_directory matrixdata
fi
source_directory=/etc/sydent
if [ -d $source_directory ]; then
backup_directory_to_usb $source_directory matrixid
fi
systemctl start matrix
fi
}
@ -373,6 +377,17 @@ function restore_local_matrix {
rm -rf $temp_restore_dir
chown -R matrix:matrix $MATRIX_DATA_DIR
temp_restore_dir=/root/tempmatrixid
restore_directory_from_usb $temp_restore_dir matrixid
cp -r $temp_restore_dir/etc/sydent/* /etc/sydent
if [ ! "$?" = "0" ]; then
function_check backup_unmount_drive
backup_unmount_drive
exit 29562
fi
rm -rf $temp_restore_dir
chown -R matrix:matrix /etc/sydent
systemctl start matrix
fi
}
@ -387,6 +402,10 @@ function backup_remote_matrix {
if [ -d $source_directory ]; then
backup_directory_to_friend $source_directory matrixdata
fi
source_directory=/etc/sydent
if [ -d $source_directory ]; then
backup_directory_to_friend $source_directory matrixid
fi
systemctl start matrix
fi
}
@ -414,6 +433,15 @@ function restore_remote_matrix {
rm -rf $temp_restore_dir
chown -R matrix:matrix $MATRIX_DATA_DIR
temp_restore_dir=/root/tempmatrixid
restore_directory_from_friend $temp_restore_dir matrixid
cp -r $temp_restore_dir/etc/sydent/* /etc/sydent
if [ ! "$?" = "0" ]; then
exit 738356
fi
rm -rf $temp_restore_dir
chown -R matrix:matrix /etc/sydent
systemctl start matrix
fi
}