Skip to content

Instantly share code, notes, and snippets.

@StudioLE
Last active August 29, 2015 14:16
Show Gist options
  • Save StudioLE/13fe689ced6ecde60354 to your computer and use it in GitHub Desktop.
Save StudioLE/13fe689ced6ecde60354 to your computer and use it in GitHub Desktop.
Tar and Backup to AWS S3
#!/bin/bash
echo "LE Tar and S3 Wizard v1"
echo "Which directory would you like to tar? [\"n\" to abort]"
ls /srv/lib/backups/dir/
read file
if [ $file = n ]
then
echo "Aborted"
exit
fi
echo "Archiving.."
tar="/srv/lib/backups/tar/"$file".tar.gz"
dir="/srv/lib/backups/dir/"$file
tar -zcf $tar $dir
echo "Archived "$file" to "$tar
echo "Would you like to copy the tar to S3? [y/n]"
read s3
if [ $s3 = n ]
then
echo "Aborted"
exit
fi
echo "Uploading.."
aws s3 cp $tar s3://le-uno/tar/
echo "Copied "$file" to S3"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment