docker-mc-backup icon indicating copy to clipboard operation
docker-mc-backup copied to clipboard

Not working when i restart the mc server

Open JordiKing10 opened this issue 2 years ago • 3 comments

I use a script with rcon-cli to restart the server of minecraft and if i do when mc-backup is working, dont work anymore. When the server is up again cant connect so i restart both at once or only the mc-backup container when mc server is UP.

Here is the debug:

  • : /data
  • : /backups
  • : Vault-Hunters
  • : 2m
  • : 4h
  • : true
  • : 10m
  • : tar
  • : gzip
  • : '-3 --long=25 --single-thread'
  • : 1
  • : '--keep-within 7d' 5
  • : mc 5
  • : ''
  • : serverjk-mc
  • : -1
  • : 10s
  • : '*.jar,cache,logs' e
  • : mc_backups
  • : /config e
  • : Europe/Madrid
  • : gzip
  • : ''
  • : ''
  • : ''
  • : ''
  • : ''
  • : ''
  • export TZ
  • export RCON_HOST
  • export RCON_PORT
  • export RCON_PASSWORD
  • export XDG_CONFIG_HOME
  • export SRC_DIR
  • export DEST_DIR
  • export BACKUP_NAME
  • [[ -n '' ]]
  • [[ -n '' ]]
  • [[ -n '' ]]
  • '[' -n '' ']'
  • '[' '!' -d /data ']'
  • is_function tar
  • '[' 1 -ne 1 ']'
  • name=tar ++ type -t tar
  • '[' function == function ']'
  • readarray -td, excludes_patterns ++ printf %s '*.jar,cache,logs'
  • excludes=()
  • for pattern in "${excludes_patterns[@]}"
  • excludes+=(--exclude "${pattern}")
  • for pattern in "${excludes_patterns[@]}"
  • excludes+=(--exclude "${pattern}")
  • for pattern in "${excludes_patterns[@]}"
  • excludes+=(--exclude "${pattern}")
  • tar init
  • call_if_function_exists init
  • '[' 1 -lt 1 ']'
  • function_name=init
  • is_function init
  • '[' 1 -ne 1 ']'
  • name=init ++ type -t init
  • '[' function == function ']'
  • init
  • mkdir -p /backups
  • case "${TAR_COMPRESS_METHOD}" in
  • tar_parameters=('--gzip')
  • readonly tar_parameters
  • readonly backup_extension=tgz
  • backup_extension=tgz
  • is_one_shot
  • [[ FALSE = TRUE ]]
  • return 1
  • log INFO 'waiting initial delay of 2m...'
  • '[' 2 -lt 1 ']'
  • local level=INFO
  • shift
  • valid_levels=('INFO' 'WARN' 'ERROR' 'INTERNALERROR')
  • local valid_levels
  • is_elem_in_array INFO INFO WARN ERROR INTERNALERROR
  • '[' 5 -lt 2 ']'
  • local element=INFO
  • shift e
  • for e in "$@"
  • '[' INFO == INFO ']'
  • return 0
  • '[' 1 -ge 1 ']'
  • cat -
  • awk -v level=INFO '{ printf("%s %s %s\n", strftime("%FT%T%z"), level, $0); fflush(); }' 2022-09-01T16:35:51+0200 INFO waiting initial delay of 2m...
  • '[' INFO == INTERNALERROR ']'
  • sleep 2m
  • log INFO 'waiting for rcon readiness...'
  • '[' 2 -lt 1 ']'
  • local level=INFO
  • shift
  • valid_levels=('INFO' 'WARN' 'ERROR' 'INTERNALERROR')
  • local valid_levels
  • is_elem_in_array INFO INFO WARN ERROR INTERNALERROR
  • '[' 5 -lt 2 ']'
  • local element=INFO
  • shift e
  • for e in "$@"
  • '[' INFO == INFO ']'
  • return 0
  • '[' 1 -ge 1 ']'
  • cat -
  • awk -v level=INFO '{ printf("%s %s %s\n", strftime("%FT%T%z"), level, $0); fflush(); }' 2022-09-01T16:37:51+0200 INFO waiting for rcon readiness...
  • '[' INFO == INTERNALERROR ']'
  • retry -1 10s rcon-cli save-on
  • '[' 4 -lt 3 ']'
  • local retries=-1
  • local interval=10s
  • readonly retries interval 2
  • (( retries < 0 ))
  • local retries_msg=infinite
  • local i=-1
  • (( retries >= ++i ))
  • '[' infinite '!=' -1 ']' ++ timeout --signal=SIGINT --kill-after=30s 5m rcon-cli save-on ++ tr '\n' '\t'
  • output='2022/09/01 16:37:51 Failed to connect to RCON serverdial tcp: lookup mc on 127.0.0.11:53: read udp 127.0.0.1:43190->127.0.0.11:53: read: connection refused '
  • log ERROR 'Unable to execute rcon-cli save-on - try 0/infinite. Retrying in 10s'
  • '[' 2 -lt 1 ']'
  • local level=ERROR
  • shift
  • valid_levels=('INFO' 'WARN' 'ERROR' 'INTERNALERROR')
  • local valid_levels
  • is_elem_in_array ERROR INFO WARN ERROR INTERNALERROR
  • '[' 5 -lt 2 ']'
  • local element=ERROR
  • shift e
  • for e in "$@"
  • '[' ERROR == INFO ']'
  • for e in "$@"
  • '[' ERROR == WARN ']'
  • for e in "$@"
  • '[' ERROR == ERROR ']'
  • return 0
  • '[' 1 -ge 1 ']'
  • cat -
  • awk -v level=ERROR '{ printf("%s %s %s\n", strftime("%FT%T%z"), level, $0); fflush(); }' 2022-09-01T16:37:51+0200 ERROR Unable to execute rcon-cli save-on - try 0/infinite. Retrying in 10s
  • '[' ERROR == INTERNALERROR ']'
  • '[' -n '2022/09/01 16:37:51 Failed to connect to RCON serverdial tcp: lookup mc on 127.0.0.11:53: read udp 127.0.0.1:43190->127.0.0.11:53: read: connection refused ' ']'
  • log ERROR 'Failure reason: 2022/09/01 16:37:51 Failed to connect to RCON serverdial tcp: lookup mc on 127.0.0.11:53: read udp 127.0.0.1:43190->127.0.0.11:53: read: connection refused '

...

JordiKing10 avatar Sep 01 '22 15:09 JordiKing10

What you're attempting should be fine.

It's actually running into a DNS problem since this is UDP to port 53

lookup mc on 127.0.0.11:53: read udp 127.0.0.1:43190->127.0.0.11:53: read: connection refused

itzg avatar Sep 01 '22 23:09 itzg

A dns error on the same machine? What could be the solution? The thing is that I use your rcon client to restart the server periodically and I have noticed that after each restart the mc-backups container remained stopped. I had thought about forcing the automatic start but it would create a backup every day after the reboot

Anyway thanks for your help!

JordiKing10 avatar Sep 02 '22 09:09 JordiKing10

Docker is providing DNS internally to resolve service names to container IP address. Google for that particular symptom to look for solutions.

The docs say to set RCON_RETRIES to a negative value to have it retry indefinitely, if you're wanting to prevent the container from stopping on failures.

itzg avatar Sep 02 '22 12:09 itzg