Skip to content

Instantly share code, notes, and snippets.

@antonshell
Created March 30, 2021 06:00
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 antonshell/e5f7104bc8a6ff35ffe89f417a4aa2d3 to your computer and use it in GitHub Desktop.
Save antonshell/e5f7104bc8a6ff35ffe89f417a4aa2d3 to your computer and use it in GitHub Desktop.
#! /bin/bash
TIMESTAMP=$(date +"%F-%T")
FILES_DIR=/var/www/my_website/web/uploads
BACKUP_DIR="/var/backups/files/my_website_backups/$TIMESTAMP"
TAR=/usr/bin/tar
AWS=/usr/bin/aws
mkdir -p "$BACKUP_DIR"
$TAR -zcvf $BACKUP_DIR/files.tar.gz $FILES_DIR
$AWS s3 cp $BACKUP_DIR s3://my-website-backups/files/$TIMESTAMP --recursive
rm -rf "$BACKUP_DIR"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment