Sometimes there is no shared data to restore
This commit is contained in:
parent
4bfd152772
commit
7ab85b55d2
|
@ -13,7 +13,7 @@
|
||||||
# License
|
# License
|
||||||
# =======
|
# =======
|
||||||
#
|
#
|
||||||
# Copyright (C) 2014-2017 Bob Mottram <bob@freedombone.net>
|
# Copyright (C) 2014-2018 Bob Mottram <bob@freedombone.net>
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as published by
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -318,14 +318,6 @@ function restore_local_syncthing {
|
||||||
mkdir -p $SYNCTHING_SHARED_DATA
|
mkdir -p $SYNCTHING_SHARED_DATA
|
||||||
fi
|
fi
|
||||||
cp -r ${temp_restore_dir}shared/* $SYNCTHING_SHARED_DATA/
|
cp -r ${temp_restore_dir}shared/* $SYNCTHING_SHARED_DATA/
|
||||||
|
|
||||||
if [ ! "$?" = "0" ]; then
|
|
||||||
set_user_permissions
|
|
||||||
backup_unmount_drive
|
|
||||||
systemctl start syncthing
|
|
||||||
systemctl start cron
|
|
||||||
exit 37904
|
|
||||||
fi
|
|
||||||
rm -rf ${temp_restore_dir}shared
|
rm -rf ${temp_restore_dir}shared
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -341,6 +333,9 @@ function restore_local_syncthing {
|
||||||
if [ -d ${temp_restore_dir}/home/$USERNAME/Sync ]; then
|
if [ -d ${temp_restore_dir}/home/$USERNAME/Sync ]; then
|
||||||
cp -r ${temp_restore_dir}/home/$USERNAME/Sync /home/$USERNAME/
|
cp -r ${temp_restore_dir}/home/$USERNAME/Sync /home/$USERNAME/
|
||||||
else
|
else
|
||||||
|
if [ ! -d /home/$USERNAME/Sync ]; then
|
||||||
|
mkdir /home/$USERNAME/Sync
|
||||||
|
fi
|
||||||
cp -r ${temp_restore_dir}/* /home/$USERNAME/Sync/
|
cp -r ${temp_restore_dir}/* /home/$USERNAME/Sync/
|
||||||
fi
|
fi
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
|
@ -425,7 +420,7 @@ function restore_remote_syncthing {
|
||||||
if [ ! -d $SYNCTHING_CONFIG_PATH ]; then
|
if [ ! -d $SYNCTHING_CONFIG_PATH ]; then
|
||||||
mkdir -p $SYNCTHING_CONFIG_PATH
|
mkdir -p $SYNCTHING_CONFIG_PATH
|
||||||
fi
|
fi
|
||||||
cp -r ${temp_restore_dir}config/* $SYNCTHING_CONFIG_PATH/
|
cp -r ${temp_restore_dir}/* $SYNCTHING_CONFIG_PATH/
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
systemctl start syncthing
|
systemctl start syncthing
|
||||||
systemctl start cron
|
systemctl start cron
|
||||||
|
@ -439,17 +434,11 @@ function restore_remote_syncthing {
|
||||||
temp_restore_dir=/root/tempsyncthingshared
|
temp_restore_dir=/root/tempsyncthingshared
|
||||||
function_check restore_directory_from_friend
|
function_check restore_directory_from_friend
|
||||||
restore_directory_from_friend $temp_restore_dir syncthingshared
|
restore_directory_from_friend $temp_restore_dir syncthingshared
|
||||||
#cp -r $temp_restore_dir/* /
|
|
||||||
if [ ! -d $SYNCTHING_SHARED_DATA ]; then
|
if [ ! -d $SYNCTHING_SHARED_DATA ]; then
|
||||||
mkdir -p $SYNCTHING_SHARED_DATA
|
mkdir -p $SYNCTHING_SHARED_DATA
|
||||||
fi
|
fi
|
||||||
cp -r ${temp_restore_dir}shared/* $SYNCTHING_SHARED_DATA/
|
cp -r ${temp_restore_dir}/* $SYNCTHING_SHARED_DATA/
|
||||||
if [ ! "$?" = "0" ]; then
|
rm -rf ${temp_restore_dir}
|
||||||
systemctl start syncthing
|
|
||||||
systemctl start cron
|
|
||||||
exit 37904
|
|
||||||
fi
|
|
||||||
rm -rf $temp_restore_dir
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d $SERVER_DIRECTORY/backup/syncthing ]; then
|
if [ -d $SERVER_DIRECTORY/backup/syncthing ]; then
|
||||||
|
@ -466,6 +455,9 @@ function restore_remote_syncthing {
|
||||||
if [ -d $temp_restore_dir/home/$USERNAME/Sync ]; then
|
if [ -d $temp_restore_dir/home/$USERNAME/Sync ]; then
|
||||||
cp -r $temp_restore_dir/home/$USERNAME/Sync /home/$USERNAME/
|
cp -r $temp_restore_dir/home/$USERNAME/Sync /home/$USERNAME/
|
||||||
else
|
else
|
||||||
|
if [ ! -d /home/$USERNAME/Sync ]; then
|
||||||
|
mkdir /home/$USERNAME/Sync
|
||||||
|
fi
|
||||||
cp -r $temp_restore_dir/* /home/$USERNAME/Sync/
|
cp -r $temp_restore_dir/* /home/$USERNAME/Sync/
|
||||||
fi
|
fi
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
|
|
Loading…
Reference in New Issue