minecraft/aws-s3-backup/files/minecraft-s3-backup.sh
author Luke Hoersten <luke@hoersten.org>
Sun, 21 Jul 2024 12:42:43 -0500
changeset 235 f88bb54f63bd
parent 165 00e0af8e76a4
permissions -rw-r--r--
Added scrypted role.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     1
#!/bin/bash
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     2
164
ae19501f5251 Updated minecraft to be multi-world and minimized world size.
Luke Hoersten <luke@hoersten.org>
parents: 158
diff changeset
     3
BACKUP_WORLD_NAME=$1
0
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     4
BACKUP_DIR=$2
164
ae19501f5251 Updated minecraft to be multi-world and minimized world size.
Luke Hoersten <luke@hoersten.org>
parents: 158
diff changeset
     5
BUCKET=$3
ae19501f5251 Updated minecraft to be multi-world and minimized world size.
Luke Hoersten <luke@hoersten.org>
parents: 158
diff changeset
     6
BACKUP_TAR_DIR=$4
ae19501f5251 Updated minecraft to be multi-world and minimized world size.
Luke Hoersten <luke@hoersten.org>
parents: 158
diff changeset
     7
BACKUP_TAR="${BACKUP_TAR_DIR}/${BUCKET}.tgz"
0
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     8
165
00e0af8e76a4 Fixed backup script error.
Luke Hoersten <luke@hoersten.org>
parents: 164
diff changeset
     9
tar -zc -f $BACKUP_TAR -C $BACKUP_DIR "$BACKUP_WORLD_NAME" "${BACKUP_WORLD_NAME}_nether" "${BACKUP_WORLD_NAME}_the_end"
0
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    10
aws s3 mb "s3://$BUCKET/"
158
1b7ccb729164 Updated minecraft backup for lifecycles.
Luke Hoersten <luke@hoersten.org>
parents: 156
diff changeset
    11
aws s3api put-bucket-versioning --bucket "$BUCKET" --versioning-configuration Status=Enabled
1b7ccb729164 Updated minecraft backup for lifecycles.
Luke Hoersten <luke@hoersten.org>
parents: 156
diff changeset
    12
aws s3api put-bucket-lifecycle-configuration --bucket "$BUCKET" --lifecycle-configuration "file:///usr/local/share/minecraft-s3-backup-lifecycle.json"
0
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    13
aws s3 cp $BACKUP_TAR "s3://$BUCKET/"
136
1751be33651f Added cleanup to mercurial backup script.
Luke Hoersten <luke@hoersten.org>
parents: 56
diff changeset
    14
1751be33651f Added cleanup to mercurial backup script.
Luke Hoersten <luke@hoersten.org>
parents: 56
diff changeset
    15
rm $BACKUP_TAR