Skip to content

Instantly share code, notes, and snippets.

@splitice
Last active December 18, 2015 05: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 splitice/5735398 to your computer and use it in GitHub Desktop.
Save splitice/5735398 to your computer and use it in GitHub Desktop.
A deployment script for sites
#!/bin/bash
## EDIT HERE
DOMAIN="domain.com"
## NO NEED TO EDIT BELOW THIS LINE ##
# Copy to backup
cp dev.$DOMAIN ${DOMAIN}_c -R --preserve
#chmod 777 ${DOMAIN}_c -R
# What is the next revisioned backup?
name=$DOMAIN
i=0
while [[ -e ${name}_b$i ]] ; do
let i++
done
name=${name}_b$i
# Tell the world
echo Backed up to $name
# Move the old to revisioned backup
mv $DOMAIN $name
# Move the new source to the htdocs directory
mv ${DOMAIN}_c $DOMAIN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment