I have this script I've used for a long time, basically it's just to sync projects from dev to test and test to prod so I can work on it locally then commit changes to test for further testing and then to prod. For some reason, suddently, it started not working. It just hangs at "building file list" for the rsync command.
The rsync command being used is this:
This worked fine like a week ago, it just randomly started doing this. I wanted to make a change to a website but it would not sync so had to SSH to the prod server and do the change manually. Any clues as to what could cause this?
This is the full script:
The rsync command being used is this:
Code:
rsync --checksum --delete-after -rva --exclude-from="${maindir}${envfr}/${proj}/syncexcludes_src.txt" "${maindir}${envfr}/${proj}/src/" "${maindir}${env}/${proj}/src/"
This worked fine like a week ago, it just randomly started doing this. I wanted to make a change to a website but it would not sync so had to SSH to the prod server and do the change manually. Any clues as to what could cause this?
This is the full script:
Code:
#!/bin/sh
maindir="/network/appdev/"
env=$1
envfr=""
if [ "$env" == "test" ] ; then
echo "syncing to test"
envfr="dev"
elif [ "$env" == "prod" ] ; then
echo "syncing to prod"
envfr="test"
else
echo "specify test or prod (environment to sync TO)"
echo "Usage: ./sync.sh [test/prod] [projectname]"
exit
fi
proj=$2
if [ "$proj" == "" ] ; then
echo "You must specify a project folder (and it has to have a src folder in it)"
exit
fi
if [ ! -d "${maindir}${envfr}/${proj}/src/" ] ; then
echo "Project ${proj} does not exist in ${envfr} or src folder not present"
exit
fi
# File change reason flags
#
# c -> checksum differs
# s -> size differs
# t -> mtime differs
# p -> permissions differ
# o -> owners
# g -> group
# u -> reserved for future use
# a -> ACLs
# x -> extended attributes
# + -> is new (all +++++'s indicates a new file)
# . -> is unchanged
echo "checks ok, syncing..."
echo "sync: src"
touch ${maindir}${envfr}/${proj}/syncexcludes_src.txt
mkdir -p "${maindir}${env}/${proj}/src/"
echo
echo "dir of destination:"
dir -ls "${maindir}${env}/${proj}/src/"
echo
echo "-------------------"
echo
echo "--------------------------------------------------------------------------------------------------------------------"
rsync --checksum --delete-after -rva --exclude-from="${maindir}${envfr}/${proj}/syncexcludes_src.txt" "${maindir}${envfr}/${proj}/src/" "${maindir}${env}/${proj}/src/"
echo "--------------------------------------------------------------------------------------------------------------------"
echo
echo "the following files were excluded as per syncexcludes_src.txt:"
echo
cat ${maindir}${envfr}/${proj}/syncexcludes_src.txt
echo
if [ -d "${maindir}${envfr}/${proj}/virdir/" ] ; then
echo "sync: virdirs"
touch ${maindir}${envfr}/${proj}/syncexcludes_virdir.txt
mkdir -p "${maindir}${env}/${proj}/virdir/"
echo
echo "---------------------------------------------------------------------------------------------------------------------"
rsync --checksum --delete-after -rva --exclude-from="${maindir}${envfr}/${proj}/syncexcludes_virdir.txt" "${maindir}${envfr}/${proj}/virdir/" "${maindir}${env}/${proj}/virdir/"
echo "---------------------------------------------------------------------------------------------------------------------"
echo
echo "the following files were excluded as per syncexcludes_virdir.txt:"
echo
cat ${maindir}${envfr}/${proj}/syncexcludes_virdir.txt
echo
echo "----"
fi
echo "Checking for secondary sync file..."
echo
cd ${maindir}${envfr}/${proj}
if [ -f "sync.sh" ] ; then
echo "executing ${proj}'s sync file..."
chmod +x sync.sh
./sync.sh
fi
echo
echo Completed.