Skip to content

Instantly share code, notes, and snippets.

Last active January 9, 2019 13:42
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save pirafrank/00529b9c07d79389847aec173bd74abf to your computer and use it in GitHub Desktop.
Backup and deploy to Amazon S3 static resources of my website (
# crontab entry
# 0 0 * * * /bin/bash /home/francesco/ > /dev/null 2>&1
# variables
ENV_PATH="/home/francesco/Code/awscli_lisa" # path to your virtualenv with awscli module
# committing to repo configured with git lfs
echo "pulling..."
git pull origin master
echo "backing up all the static files to the repo..."
git add .
sleep 1
git commit -m 'commit'
sleep 1
git push origin --all
# Sync to S3 bucket
source "$ENV_PATH""/bin/activate"
echo "Virtualenv is: ""$ENV_PATH""/bin/activate"
echo "Starting sync TO S3..."
aws s3 sync "$SOURCE_SYNC" "s3://""$S3_DEST" --exclude ".git/*"
# Greetings
echo "
All done! Bye...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment