Created
March 12, 2019 17:57
-
-
Save jeanatcismet/784a733ca4fde684a942a9b166c5ce8e to your computer and use it in GitHub Desktop.
dry-run of rotate-backups and transforming result into commands for manual removal of file via rclone_mount
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
RCLONE_CONF=$(pwd)/rclone.conf | |
RCLONE_SRC=gdrive:/cismet/backups/ | |
ROTATE_BACKUPS_PATH="*" | |
ROTATE_BACKUPS_OPTIONS="--dry-run --daily=10 --weekly=5 --monthly=13 --yearly=5" | |
# === | |
DATA=$(pwd)/data | |
USER=backup | |
FILES=$(docker run -t --rm \ | |
-e PUID=$(id -u $USER) \ | |
-e PGID=$(id -g $USER) \ | |
-v $RCLONE_CONF:/home/.rclone.conf \ | |
--device /dev/fuse \ | |
--privileged \ | |
cismet/rclone-rotate-backups \ | |
"$RCLONE_SRC" "$ROTATE_BACKUPS_PATH" "$ROTATE_BACKUPS_OPTIONS" | grep Deleting | awk '{print $7}') | |
RCLONE_MOUNT=backups | |
MOUNT_RCLONE_GIST=https://gist.github.com/jeanatcismet/096ecafc0cdabf163e8e0257a31ea7eb#file-mount_rclone-sh | |
echo "# mount_rlcone.sh => $MOUNT_RCLONE_GIST" | |
echo "mkdir -p $RCLONE_MOUNT && ./mount_rclone.sh \$(pwd)/rclone.conf $RCLONE_SRC \$(pwd)/$RCLONE_MOUNT" | |
echo "# paste in another console => " | |
for FILE in $FILES; do | |
echo rm ./$RCLONE_MOUNT/${FILE##"~/mnt/"} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment