feat: move bakcups to backblaze
This commit is contained in:
parent
48eceae7aa
commit
9009c2e2af
1 changed files with 10 additions and 4 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
let
|
||||
mcDataDir = "/srv/minecraft/data";
|
||||
b2Bucket = "compsigh-minecraft-backups"; # TODO: change to your bucket name
|
||||
b2Bucket = "compsigh-server-backups";
|
||||
in
|
||||
{
|
||||
systemd.services.minecraft-backup = {
|
||||
|
|
@ -12,6 +12,8 @@ in
|
|||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = pkgs.writeShellScript "minecraft-backup" ''
|
||||
set -euo pipefail
|
||||
|
||||
TEMP_BACKUP="/tmp/minecraft-world-latest.tar.gz"
|
||||
|
||||
# Check if the container is running
|
||||
|
|
@ -25,9 +27,13 @@ in
|
|||
sleep 2
|
||||
docker exec minecraft rcon-cli save-off
|
||||
|
||||
# Compress world data
|
||||
${pkgs.gnutar}/bin/tar czf "$TEMP_BACKUP" \
|
||||
-C ${mcDataDir} world world_nether world_the_end
|
||||
# Compress world data (re-enable saving even if tar fails)
|
||||
if ! ${pkgs.gnutar}/bin/tar czf "$TEMP_BACKUP" \
|
||||
-C ${mcDataDir} world world_nether world_the_end; then
|
||||
echo "tar failed, re-enabling saving"
|
||||
docker exec minecraft rcon-cli save-on
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Re-enable saving immediately
|
||||
docker exec minecraft rcon-cli save-on
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue