Compare commits

..

No commits in common. "master" and "flake" have entirely different histories.

5 changed files with 7 additions and 26 deletions

View file

@ -1,10 +1,10 @@
FROM alpine FROM alpine
LABEL org.opencontainers.image.source=https://forgejo.nevy.xyz/nev/minecraft-backup LABEL org.opencontainers.image.source=https://github.com/nicolaschan/minecraft-backup
RUN apk add bash coreutils xxd restic util-linux openssh rclone RUN apk add bash coreutils xxd restic util-linux openssh
WORKDIR /code WORKDIR /code
COPY ./backup.sh . COPY ./backup.sh .
ENTRYPOINT ["/bin/sh", "-c"] ENTRYPOINT ["/code/backup.sh"]

View file

@ -44,9 +44,6 @@ docker run \
-v /home/user/server/world:/mnt/server \ -v /home/user/server/world:/mnt/server \
-v /mnt/storage/backups:/mnt/backups \ -v /mnt/storage/backups:/mnt/backups \
ghcr.io/nicolaschan/minecraft-backup -c -i /mnt/server -o /mnt/backups -s server-host:25575:secret -w rcon ghcr.io/nicolaschan/minecraft-backup -c -i /mnt/server -o /mnt/backups -s server-host:25575:secret -w rcon
# Using itzg/docker-minecraft-server container and rcon cli
./backup.sh -c -i /home/user/server/world -o /mnt/storage/backups -s container-name -w docker-rcon
``` ```
This will show chat messages (`-c`) and save a backup of `/home/user/server/world` into `/mnt/storage/backups` using the default thinning deletion policy for old backups. This will show chat messages (`-c`) and save a backup of `/home/user/server/world` into `/mnt/storage/backups` using the default thinning deletion policy for old backups.
@ -67,7 +64,7 @@ Command line options:
-p Prefix that shows in Minecraft chat (default: Backup) -p Prefix that shows in Minecraft chat (default: Backup)
-q Suppress warnings -q Suppress warnings
-r Restic repo name (if using restic) -r Restic repo name (if using restic)
-s Screen name, tmux session name, hostname:port:password for RCON or [container name](https://github.com/itzg/docker-minecraft-server) for docker-rcon -s Screen name, tmux session name, or hostname:port:password for RCON
-t Enable lock file (lock file not used by default) -t Enable lock file (lock file not used by default)
-u Lock file timeout seconds (empty = unlimited) -u Lock file timeout seconds (empty = unlimited)
-v Verbose mode -v Verbose mode

View file

@ -266,8 +266,6 @@ execute-command () {
;; ;;
"RCON"|"rcon") rcon-command "$SCREEN_NAME" "$COMMAND" "RCON"|"rcon") rcon-command "$SCREEN_NAME" "$COMMAND"
;; ;;
"docker-rcon") docker exec "$SCREEN_NAME" rcon-cli "$COMMAND"
;;
esac esac
fi fi
} }

6
flake.lock generated
View file

@ -20,11 +20,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1725634671, "lastModified": 1723175592,
"narHash": "sha256-v3rIhsJBOMLR8e/RNWxr828tB+WywYIoajrZKFM+0Gg=", "narHash": "sha256-M0xJ3FbDUc4fRZ84dPGx5VvgFsOzds77KiBMW/mMTnI=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "574d1eac1c200690e27b8eb4e24887f8df7ac27c", "rev": "5e0ca22929f3342b19569b21b2f3462f053e497b",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -379,20 +379,6 @@ test-rcon-interface-not-running () {
assertContains "$OUTPUT" "Could not connect" assertContains "$OUTPUT" "Could not connect"
} }
test-docker-rcon () {
CONTAINER="$(docker run -d -e EULA=TRUE docker.io/itzg/minecraft-server)"
while ! docker exec "$CONTAINER" grep 'RCON running on 0.0.0.0:25575' /data/logs/latest.log; do
sleep 0.1
done
TIMESTAMP="$(date +%F_%H-%M-%S --date="2021-01-01")"
./backup.sh -w docker-rcon -i "$TEST_TMP/server/world" -o "$TEST_TMP/backups" -s "$CONTAINER" -f "$TIMESTAMP"
OUTPUT="$(docker exec "$CONTAINER" cat /data/logs/latest.log)"
docker rm -f "$CONTAINER"
assertContains "$OUTPUT" "[Rcon: Automatic saving is now disabled]"
assertContains "$OUTPUT" "[Rcon: Automatic saving is now enabled]"
assertContains "$OUTPUT" "[Rcon: Saved the game]"
}
test-sequential-delete () { test-sequential-delete () {
for i in $(seq 0 20); do for i in $(seq 0 20); do
TIMESTAMP="$(date +%F_%H-%M-%S --date="2021-01-01 +$i hour")" TIMESTAMP="$(date +%F_%H-%M-%S --date="2021-01-01 +$i hour")"