Skip to content

Instantly share code, notes, and snippets.

@jensens
Created February 18, 2021 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jensens/ac9af68eb16bfbe579e3aa0a20456ce0 to your computer and use it in GitHub Desktop.
Save jensens/ac9af68eb16bfbe579e3aa0a20456ce0 to your computer and use it in GitHub Desktop.
Rsync via hard link whole tree of blobs (Plone/Zope)
echo "COPY DB ----------------------------------------------------------------------"
rm -rf latest-pgdb
cp -R live-pgdb latest-pgdb
chown -R 500.1001 latest-pgdb
echo "COPY BLOBS -------------------------------------------------------------------"
SOURCE=/data/aaf/live-blobs
TARGET=/data/aaf/latest-blobs
LINKDEST=`python3 -c "import os.path; print(os.path.relpath('$SOURCE', '$TARGET'))"`
rsync -avh --delete-during --link-dest=$LINKDEST $SOURCE/ $TARGET
echo "COPY NGINX -------------------------------------------------------------------"
SOURCE=/data/aaf/live-nginx-at
TARGET=/data/aaf/latest-nginx-at
LINKDEST=`python3 -c "import os.path; print(os.path.relpath('$SOURCE', '$TARGET'))"`
rsync -avh --delete-during --link-dest=$LINKDEST $SOURCE/ $TARGET
SOURCE=/data/aaf/live-static
echo "COPY STATIC ------------------------------------------------------------------"
TARGET=/data/aaf/latest-static
LINKDEST=`python3 -c "import os.path; print(os.path.relpath('$SOURCE', '$TARGET'))"`
rsync -avh --delete-during --link-dest=$LINKDEST $SOURCE/ $TARGET
echo "DONE ------ ------------------------------------------------------------------"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment