Skip to content

Instantly share code, notes, and snippets.

@melvyn-sopacua
Created October 5, 2015 11:27
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 melvyn-sopacua/aa59c508ab6bcf131eb0 to your computer and use it in GitHub Desktop.
Save melvyn-sopacua/aa59c508ab6bcf131eb0 to your computer and use it in GitHub Desktop.
Synchronize media to staging on hypernode without diskspace impact
#!/bin/sh
_me=`basename $0`
_prod_root='/data/web/public'
_stage_root='/data/web/staging'
_wp_subdir='blog'
_wp_imageroot=''
[ ! -z "${_wp_subdir}" ] && _wp_imageroot="${_wp_subdir}/wp-content/uploads"
echo "Synchronizing media to staging (${_stage_root})"
cd ${_prod_root}
find media -depth -type f -print0 | cpio -dumpl -0 ${_stage_root}
if [ ! -z "${_wp_imageroot}" ]
then
if [ -d ${_wp_imageroot} ]
then
echo "Synchronizing wordpress images to ${_stage_root}"
find blog/wp-content/uploads -depth -type f -print0 | \
cpio -dumpl -0 ${_stage_root}
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment