equal
deleted
inserted
replaced
1 #!/bin/bash |
1 #!/bin/bash |
2 |
2 |
3 BUCKET=$1 |
3 BUCKET=$1 |
4 DATE=`date --iso-8601` |
|
5 BACKUP_DIR=$2 |
4 BACKUP_DIR=$2 |
6 BACKUP_TAR="/tmp/$BUCKET-$DATE.tgz" |
5 BACKUP_TAR="/tmp/$BUCKET.tgz" |
7 |
6 |
8 tar -zc -f $BACKUP_TAR $BACKUP_DIR |
7 tar -zc -f $BACKUP_TAR $BACKUP_DIR |
9 aws s3 mb "s3://$BUCKET/" |
8 aws s3 mb "s3://$BUCKET/" |
|
9 aws s3api put-bucket-versioning --bucket "$BUCKET" --versioning-configuration Status=Enabled |
|
10 aws s3api put-bucket-lifecycle-configuration --bucket "$BUCKET" --lifecycle-configuration "file:///usr/local/share/minecraft-s3-backup-lifecycle.json" |
10 aws s3 cp $BACKUP_TAR "s3://$BUCKET/" |
11 aws s3 cp $BACKUP_TAR "s3://$BUCKET/" |
11 |
12 |
12 rm $BACKUP_TAR |
13 rm $BACKUP_TAR |