updated backup script
This commit is contained in:
@@ -21,13 +21,13 @@ then
|
|||||||
udisksctl unlock -b /dev/disk/by-partlabel/$DISK --key-file "$HOME/.keys/luks.key"
|
udisksctl unlock -b /dev/disk/by-partlabel/$DISK --key-file "$HOME/.keys/luks.key"
|
||||||
fi
|
fi
|
||||||
#check if mounted
|
#check if mounted
|
||||||
if [ -e "/run/media/$USER/$DISK" ]
|
if [ -e "/media/$USER/$DISK" ]
|
||||||
then
|
then
|
||||||
echo "Disk already mounted"
|
echo "Disk already mounted"
|
||||||
else
|
else
|
||||||
udisksctl mount -b /dev/disk/by-label/$DISK
|
udisksctl mount -b /dev/disk/by-label/$DISK
|
||||||
fi
|
fi
|
||||||
REPO="/run/media/$USER/$DISK/borg"
|
REPO="/media/$USER/$DISK/borg"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ borg create --progress --stats --exclude-caches \
|
|||||||
--exclude $HOME/Audio \
|
--exclude $HOME/Audio \
|
||||||
--exclude $HOME/nas \
|
--exclude $HOME/nas \
|
||||||
--exclude $HOME/go \
|
--exclude $HOME/go \
|
||||||
--exclude $HOME/.var/app/com.valvesoftware.Steam \
|
--exclude $HOME/.var/app \
|
||||||
--exclude $HOME/.config/borg/security/ \
|
--exclude $HOME/.config/borg/security/ \
|
||||||
$ARCHIVE $SRC && if ! $LOCAL; then date +%s > $HOME/.lastbak; fi
|
$ARCHIVE $SRC && if ! $LOCAL; then date +%s > $HOME/.lastbak; fi
|
||||||
|
|
||||||
@@ -65,33 +65,6 @@ borg prune --stats --list --keep-within 1d --glob-archives "$HOSTNAME*" \
|
|||||||
|
|
||||||
if $LOCAL
|
if $LOCAL
|
||||||
then
|
then
|
||||||
SRC=""
|
|
||||||
if ! nmcli connection show --active | grep '^vt-net' > /dev/null
|
|
||||||
then
|
|
||||||
SRC="--from local"
|
|
||||||
fi
|
|
||||||
echo "backing up Photo archive..."
|
|
||||||
cd "/run/media/$USER/$DISK/photos"
|
|
||||||
git annex sync
|
|
||||||
# set +e
|
|
||||||
# git annex mirror --from=origin
|
|
||||||
git annex get $SRC
|
|
||||||
# set -e
|
|
||||||
git annex sync
|
|
||||||
echo "backing up Audio archive..."
|
|
||||||
cd "/run/media/$USER/$DISK/audio"
|
|
||||||
git annex sync
|
|
||||||
### git annex mirror --from=origin
|
|
||||||
git annex get $SRC
|
|
||||||
git annex sync
|
|
||||||
cd /
|
|
||||||
udisksctl unmount -b "/dev/disk/by-label/$DISK"
|
udisksctl unmount -b "/dev/disk/by-label/$DISK"
|
||||||
udisksctl lock -b "/dev/disk/by-partlabel/$DISK"
|
udisksctl lock -b "/dev/disk/by-partlabel/$DISK"
|
||||||
#else
|
|
||||||
# echo "Backing up Audo archive..."
|
|
||||||
# cd "$HOME/Audio"
|
|
||||||
# git annex copy --to origin > /dev/null
|
|
||||||
# echo "Backing up Photo archive..."
|
|
||||||
# cd "$HOME/Photos"
|
|
||||||
# git annex copy --to origin > /dev/null
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user