Last active
August 29, 2015 14:16
-
-
Save StudioLE/13fe689ced6ecde60354 to your computer and use it in GitHub Desktop.
Tar and Backup to AWS S3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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