fix: make backing up robust and lengthen discord ping
This commit is contained in:
parent
298d2f10a4
commit
853e6e18a9
2 changed files with 18 additions and 9 deletions
|
|
@ -27,16 +27,16 @@ in
|
||||||
sleep 2
|
sleep 2
|
||||||
docker exec minecraft rcon-cli save-off
|
docker exec minecraft rcon-cli save-off
|
||||||
|
|
||||||
# Compress world data (re-enable saving even if tar fails)
|
# Ensure save-on runs no matter how the script exits from here
|
||||||
if ! ${pkgs.gnutar}/bin/tar czf "$TEMP_BACKUP" \
|
trap 'docker exec minecraft rcon-cli save-on' EXIT
|
||||||
-C ${mcDataDir} world; then
|
|
||||||
echo "tar failed, re-enabling saving"
|
|
||||||
docker exec minecraft rcon-cli save-on
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Re-enable saving immediately
|
# Compress world data
|
||||||
|
${pkgs.gnutar}/bin/tar czf "$TEMP_BACKUP" \
|
||||||
|
-C ${mcDataDir} world
|
||||||
|
|
||||||
|
# Re-enable saving immediately (trap will also fire, but save-on is idempotent)
|
||||||
docker exec minecraft rcon-cli save-on
|
docker exec minecraft rcon-cli save-on
|
||||||
|
trap - EXIT
|
||||||
|
|
||||||
# Upload to B2 (overwrites the single backup file)
|
# Upload to B2 (overwrites the single backup file)
|
||||||
B2_ACCOUNT=$(cat ${config.age.secrets.b2-account-id.path})
|
B2_ACCOUNT=$(cat ${config.age.secrets.b2-account-id.path})
|
||||||
|
|
@ -47,8 +47,17 @@ in
|
||||||
":b2:${b2Bucket}/world-latest.tar.gz" \
|
":b2:${b2Bucket}/world-latest.tar.gz" \
|
||||||
--b2-account "$B2_ACCOUNT" \
|
--b2-account "$B2_ACCOUNT" \
|
||||||
--b2-key "$B2_KEY" \
|
--b2-key "$B2_KEY" \
|
||||||
|
--b2-hard-delete \
|
||||||
|
--config /dev/null \
|
||||||
--no-check-dest
|
--no-check-dest
|
||||||
|
|
||||||
|
# Purge old file versions to stay under storage cap
|
||||||
|
${pkgs.rclone}/bin/rclone cleanup \
|
||||||
|
":b2:${b2Bucket}" \
|
||||||
|
--b2-account "$B2_ACCOUNT" \
|
||||||
|
--b2-key "$B2_KEY" \
|
||||||
|
--config /dev/null
|
||||||
|
|
||||||
# Clean up local temp file
|
# Clean up local temp file
|
||||||
rm -f "$TEMP_BACKUP"
|
rm -f "$TEMP_BACKUP"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ in
|
||||||
"playerCountVoiceChannelId": "",
|
"playerCountVoiceChannelId": "",
|
||||||
"useWebhook": true,
|
"useWebhook": true,
|
||||||
"updateChannelTopic": true,
|
"updateChannelTopic": true,
|
||||||
"channelUpdateInterval": 300000,
|
"channelUpdateInterval": 600000,
|
||||||
"allowedMentions": ["users", "roles"],
|
"allowedMentions": ["users", "roles"],
|
||||||
"broadcastPlayerCommandExecution": false,
|
"broadcastPlayerCommandExecution": false,
|
||||||
"announceServerStartStop": true,
|
"announceServerStartStop": true,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue