Update password backup scripts
parent
a6a85d1ea5
commit
2f4ed6cc51
|
@ -0,0 +1,19 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Backup existing password databases and
|
||||||
|
# database keys (using date in filename date -u
|
||||||
|
# +%Y-%m-%d_%H-%M-%S)
|
||||||
|
|
||||||
|
RCLONE_REMOTE="proton-drive"
|
||||||
|
|
||||||
|
for f in "$HOME/doc"/*.{kdbx,kdbx.key}; do
|
||||||
|
[ -e "$f" ] || continue
|
||||||
|
echo "Backing up $f to $f-$(date -u +%Y-%m-%d_%H-%M-%S)"
|
||||||
|
cp "$f" "$f-$(date -u +%Y-%m-%d_%H-%M-%S)"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Restoring KeePassXC databases and database keys"
|
||||||
|
rclone copyto \
|
||||||
|
"$RCLONE_REMOTE:doc"/ "$HOME/doc/" \
|
||||||
|
--progress \
|
||||||
|
--include "/*.{kdbx,kdbx.key}"
|
|
@ -14,7 +14,8 @@ RCLONE_REMOTE="proton-drive"
|
||||||
if [ 0 -lt "$(ls $HOME/doc/*.kdbx 2>/dev/null | wc -w)" ]; then
|
if [ 0 -lt "$(ls $HOME/doc/*.kdbx 2>/dev/null | wc -w)" ]; then
|
||||||
echo "Saving KeePassXC databases and database keys"
|
echo "Saving KeePassXC databases and database keys"
|
||||||
rclone copyto \
|
rclone copyto \
|
||||||
"$HOME/doc/" proton-drive:doc/ \
|
"$HOME/doc/" "$RCLONE_REMOTE:doc"/ \
|
||||||
|
--progress \
|
||||||
--include "/*.{kdbx,kdbx.key}"
|
--include "/*.{kdbx,kdbx.key}"
|
||||||
else
|
else
|
||||||
echo "No password database found, use the following commands to restore"
|
echo "No password database found, use the following commands to restore"
|
||||||
|
|
Loading…
Reference in New Issue