Move syncthing users backup to app script
This commit is contained in:
parent
20dffe1b61
commit
6afd2ddf42
|
@ -237,6 +237,29 @@ function backup_local_syncthing {
|
|||
|
||||
echo $"Backup to syncthing complete"
|
||||
fi
|
||||
|
||||
for d in /home/*/ ; do
|
||||
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
|
||||
if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
|
||||
if [ -d /home/$USERNAME/Sync ]; then
|
||||
echo $"Backing up syncthing files for $USERNAME"
|
||||
backup_directory_to_usb /home/$USERNAME/Sync syncthing/$USERNAME
|
||||
# ensure that device IDs will be backed up as part of user config settings
|
||||
if [ ! -d /home/$USERNAME/.config/syncthing ]; then
|
||||
mkdir -p /home/$USERNAME/.config/syncthing
|
||||
chown -R $USERNAME:$USERNAME /home/$USERNAME/.config
|
||||
fi
|
||||
if [ -f /home/$USERNAME/.syncthing-server-id ]; then
|
||||
cp /home/$USERNAME/.syncthing-server-id /home/$USERNAME/.config/syncthing
|
||||
chown -R $USERNAME:$USERNAME /home/$USERNAME/.config
|
||||
fi
|
||||
if [ -f /home/$USERNAME/.syncthingids ]; then
|
||||
cp /home/$USERNAME/.syncthingids /home/$USERNAME/.config/syncthing
|
||||
chown -R $USERNAME:$USERNAME /home/$USERNAME/.config
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function restore_local_syncthing {
|
||||
|
@ -327,6 +350,29 @@ function backup_remote_syncthing {
|
|||
backup_directory_to_friend /var/lib/syncthing/SyncShared syncthingshared
|
||||
echo $"Backup of syncthing shared files complete"
|
||||
fi
|
||||
|
||||
for d in /home/*/ ; do
|
||||
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
|
||||
if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
|
||||
if [ -d /home/$USERNAME/Sync ]; then
|
||||
echo $"Backing up syncthing files for $USERNAME"
|
||||
backup_directory_to_friend /home/$USERNAME/Sync syncthing/$USERNAME
|
||||
# ensure that device IDs will be backed up as part of user config settings
|
||||
if [ ! -d /home/$USERNAME/.config/syncthing ]; then
|
||||
mkdir -p /home/$USERNAME/.config/syncthing
|
||||
chown -R $USERNAME:$USERNAME /home/$USERNAME/.config
|
||||
fi
|
||||
if [ -f /home/$USERNAME/.syncthing-server-id ]; then
|
||||
cp /home/$USERNAME/.syncthing-server-id /home/$USERNAME/.config/syncthing
|
||||
chown -R $USERNAME:$USERNAME /home/$USERNAME/.config
|
||||
fi
|
||||
if [ -f /home/$USERNAME/.syncthingids ]; then
|
||||
cp /home/$USERNAME/.syncthingids /home/$USERNAME/.config/syncthing
|
||||
chown -R $USERNAME:$USERNAME /home/$USERNAME/.config
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function restore_remote_syncthing {
|
||||
|
|
|
@ -124,25 +124,6 @@ function backup_users {
|
|||
backup_directory_to_usb /home/$USERNAME/.fin fin/$USERNAME
|
||||
fi
|
||||
|
||||
# Backup syncthing
|
||||
if [ -d /home/$USERNAME/Sync ]; then
|
||||
echo $"Backing up syncthing files for $USERNAME"
|
||||
backup_directory_to_usb /home/$USERNAME/Sync syncthing/$USERNAME
|
||||
# ensure that device IDs will be backed up as part of user config settings
|
||||
if [ ! -d /home/$USERNAME/.config/syncthing ]; then
|
||||
mkdir -p /home/$USERNAME/.config/syncthing
|
||||
chown -R $USERNAME:$USERNAME /home/$USERNAME/.config
|
||||
fi
|
||||
if [ -f /home/$USERNAME/.syncthing-server-id ]; then
|
||||
cp /home/$USERNAME/.syncthing-server-id /home/$USERNAME/.config/syncthing
|
||||
chown -R $USERNAME:$USERNAME /home/$USERNAME/.config
|
||||
fi
|
||||
if [ -f /home/$USERNAME/.syncthingids ]; then
|
||||
cp /home/$USERNAME/.syncthingids /home/$USERNAME/.config/syncthing
|
||||
chown -R $USERNAME:$USERNAME /home/$USERNAME/.config
|
||||
fi
|
||||
fi
|
||||
|
||||
# Backup emacs
|
||||
if [ -d /home/$USERNAME/.emacs.d ]; then
|
||||
echo $"Backing up Emacs config for $USERNAME"
|
||||
|
|
Loading…
Reference in New Issue