minecraft/aws-s3-backup/files/minecraft-s3-backup.sh
changeset 164 ae19501f5251
parent 158 1b7ccb729164
child 165 00e0af8e76a4
equal deleted inserted replaced
163:40b78af86337 164:ae19501f5251
     1 #!/bin/bash
     1 #!/bin/bash
     2 
     2 
     3 BUCKET=$1
     3 BACKUP_WORLD_NAME=$1
     4 BACKUP_DIR=$2
     4 BACKUP_DIR=$2
     5 BACKUP_TAR="/tmp/$BUCKET.tgz"
     5 BUCKET=$3
       
     6 BACKUP_TAR_DIR=$4
       
     7 BACKUP_TAR="${BACKUP_TAR_DIR}/${BUCKET}.tgz"
     6 
     8 
     7 tar -zc -f $BACKUP_TAR $BACKUP_DIR
     9 tar -zc -f $BACKUP_TAR -C $BACKUP_DIR $BACKUP_WORLD_NAME {$BACKUP_WORLD_NAME}_nether ${BACKUP_WORLD_NAME}_the_end
     8 aws s3 mb "s3://$BUCKET/"
    10 aws s3 mb "s3://$BUCKET/"
     9 aws s3api put-bucket-versioning --bucket "$BUCKET" --versioning-configuration Status=Enabled
    11 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"
    12 aws s3api put-bucket-lifecycle-configuration --bucket "$BUCKET" --lifecycle-configuration "file:///usr/local/share/minecraft-s3-backup-lifecycle.json"
    11 aws s3 cp $BACKUP_TAR "s3://$BUCKET/"
    13 aws s3 cp $BACKUP_TAR "s3://$BUCKET/"
    12 
    14