Move remote tox restore to app script

This commit is contained in:
Bob Mottram 2016-07-10 14:54:19 +01:00
parent f4d4aeacfe
commit 81d4fab283
3 changed files with 42 additions and 59 deletions

View File

@ -107,7 +107,33 @@ function backup_remote_mumble {
}
function restore_remote_mumble {
echo -n ''
if [ -d $SERVER_DIRECTORY/backup/voip ]; then
echo $"Restoring Mumble settings"
temp_restore_dir=/root/tempvoip
function_check restore_directory_from_friend
restore_directory_from_friend $temp_restore_dir voip
cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/mumble-server.ini /etc/
if [ ! "$?" = "0" ]; then
rm -rf $temp_restore_dir
exit 7823
fi
cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/sipwitch.conf /etc/sipwitch.conf
if [ ! "$?" = "0" ]; then
rm -rf $temp_restore_dir
exit 7823
fi
cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/mumble-server.sqlite /var/lib/mumble-server/
if [ ! "$?" = "0" ]; then
rm -rf $temp_restore_dir
exit 276
fi
rm -rf $temp_restore_dir
cp /etc/ssl/certs/mumble* /var/lib/mumble-server
cp /etc/ssl/private/mumble* /var/lib/mumble-server
chown -R mumble-server:mumble-server /var/lib/mumble-server
service mumble-server restart
echo $"Restore of Mumble complete"
fi
}
function remove_mumble {

View File

@ -117,7 +117,21 @@ function backup_remote_tox {
}
function restore_remote_tox {
echo -n ''
if [ -d $SERVER_DIRECTORY/backup/tox ]; then
echo $"Restoring Tox node settings"
function_check restore_directory_from_friend
restore_directory_from_friend / tox
if [ ! "$?" = "0" ]; then
exit 93653
fi
cp /var/lib/tox-bootstrapd/tox-bootstrapd.conf /etc/tox-bootstrapd.conf
systemctl restart tox-bootstrapd.service
if [ ! "$?" = "0" ]; then
systemctl status tox-bootstrapd.service
exit 59369
fi
echo $"Restore of Tox node complete"
fi
}
function remove_tox_node {

View File

@ -666,61 +666,6 @@ function restore_mailing_list {
fi
}
function restore_voip {
if [[ $RESTORE_APP != 'all' ]]; then
if [[ $RESTORE_APP != 'voip' ]]; then
return
fi
fi
if [ -d $SERVER_DIRECTORY/backup/voip ]; then
echo $"Restoring VoIP settings"
temp_restore_dir=/root/tempvoip
restore_directory_from_friend $temp_restore_dir voip
cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/mumble-server.ini /etc/
if [ ! "$?" = "0" ]; then
rm -rf $temp_restore_dir
exit 7823
fi
cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/sipwitch.conf /etc/sipwitch.conf
if [ ! "$?" = "0" ]; then
rm -rf $temp_restore_dir
exit 7823
fi
cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/mumble-server.sqlite /var/lib/mumble-server/
if [ ! "$?" = "0" ]; then
rm -rf $temp_restore_dir
exit 276
fi
rm -rf $temp_restore_dir
cp /etc/ssl/certs/mumble* /var/lib/mumble-server
cp /etc/ssl/private/mumble* /var/lib/mumble-server
chown -R mumble-server:mumble-server /var/lib/mumble-server
service sipwitch restart
service mumble-server restart
fi
}
function restore_tox {
if [[ $RESTORE_APP != 'all' ]]; then
if [[ $RESTORE_APP != 'tox' ]]; then
return
fi
fi
if [ -d $SERVER_DIRECTORY/backup/tox ]; then
echo $"Restoring Tox node settings"
restore_directory_from_friend / tox
if [ ! "$?" = "0" ]; then
exit 93653
fi
cp /var/lib/tox-bootstrapd/tox-bootstrapd.conf /etc/tox-bootstrapd.conf
systemctl restart tox-bootstrapd.service
if [ ! "$?" = "0" ]; then
systemctl status tox-bootstrapd.service
exit 59369
fi
fi
}
function restore_email {
if [[ $RESTORE_APP != 'all' ]]; then
if [[ $RESTORE_APP != 'email' ]]; then
@ -794,8 +739,6 @@ restore_mailing_list
restore_email
#restore_apps remote
restore_voip
restore_tox
restore_dlna
echo $"*** Remote restore was successful ***"