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
|
||||
docker exec minecraft rcon-cli save-off
|
||||
|
||||
# Compress world data (re-enable saving even if tar fails)
|
||||
if ! ${pkgs.gnutar}/bin/tar czf "$TEMP_BACKUP" \
|
||||
-C ${mcDataDir} world; then
|
||||
echo "tar failed, re-enabling saving"
|
||||
docker exec minecraft rcon-cli save-on
|
||||
exit 1
|
||||
fi
|
||||
# Ensure save-on runs no matter how the script exits from here
|
||||
trap 'docker exec minecraft rcon-cli save-on' EXIT
|
||||
|
||||
# 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
|
||||
trap - EXIT
|
||||
|
||||
# Upload to B2 (overwrites the single backup file)
|
||||
B2_ACCOUNT=$(cat ${config.age.secrets.b2-account-id.path})
|
||||
|
|
@ -47,8 +47,17 @@ in
|
|||
":b2:${b2Bucket}/world-latest.tar.gz" \
|
||||
--b2-account "$B2_ACCOUNT" \
|
||||
--b2-key "$B2_KEY" \
|
||||
--b2-hard-delete \
|
||||
--config /dev/null \
|
||||
--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
|
||||
rm -f "$TEMP_BACKUP"
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ in
|
|||
"playerCountVoiceChannelId": "",
|
||||
"useWebhook": true,
|
||||
"updateChannelTopic": true,
|
||||
"channelUpdateInterval": 300000,
|
||||
"channelUpdateInterval": 600000,
|
||||
"allowedMentions": ["users", "roles"],
|
||||
"broadcastPlayerCommandExecution": false,
|
||||
"announceServerStartStop": true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue