Skip to content

The /usr/bin/backup<number>-now scripts are duplicated at each container restart #414

Open
@Oni

Description

@Oni

Summary

Every time I restart the container, the scripts at /usr/bin/backup<number>-now are duplicated. f I try to run backup-now the backups are done multiple times.

Steps to reproduce

  1. Restart the container multiple times;
  2. Run cat /usr/bin/backup01-now;
  3. The content is duplicated at each restart:
#!/bin/bash
source /assets/functions/00-container
PROCESS_NAME=db-backup01
print_info "Starting Manual Backup for db-backup01"
#/var/run/s6/legacy-services/dbbackup-01/run now
/etc/services.available/dbbackup-01/run now

#!/bin/bash
source /assets/functions/00-container
PROCESS_NAME=db-backup01
print_info "Starting Manual Backup for db-backup01"
#/var/run/s6/legacy-services/dbbackup-01/run now
/etc/services.available/dbbackup-01/run now

#!/bin/bash
source /assets/functions/00-container
PROCESS_NAME=db-backup01
print_info "Starting Manual Backup for db-backup01"
#/var/run/s6/legacy-services/dbbackup-01/run now
/etc/services.available/dbbackup-01/run now

#!/bin/bash
source /assets/functions/00-container
PROCESS_NAME=db-backup01
print_info "Starting Manual Backup for db-backup04"
#/var/run/s6/legacy-services/dbbackup-01/run now
/etc/services.available/dbbackup-01/run now

What is the expected correct behavior?

If I restart the container multiple times, backup-now should do a single backup per database

Environment

Deployed with docker-compose:

services:
  db_dumper:
    container_name: db_dumper
    image: ghcr.io/tiredofit/docker-db-backup:4.1.17
    environment:
      USER_DBBACKUP: 1030 # user id allowed to access volumes
      GROUP_DBBACKUP: 101 # PUID group allowed to access volumes
      TIMEZONE: Europe/Rome
      CONTAINER_ENABLE_MONITORING: 'FALSE'
      BACKUP_JOB_CONCURRENCY: 1        # Only run one job at a time

      DEFAULT_CHECKSUM: NONE           # Don't create checksums
      DEFAULT_COMPRESSION: NONE        # Don't compress
      DEFAULT_BACKUP_BEGIN: 30 1 * * 0 # Start backing up at 1:30 sunady night
      DEFAULT_CLEANUP_TIME: 8640       # Cleanup backups after 6 days
      DEFAULT_SCRIPT_LOCATION_POST: /assets/scripts/post/

      DB01_TYPE: pgsql
      DB01_HOST: REDACTED
      DB01_NAME: REDACTED
      DB01_USER: REDACTED
      DB01_PASS: REDACTED

      DB02_TYPE: pgsql
      DB02_HOST: REDACTED
      DB02_NAME: REDACTED
      DB02_USER: REDACTED
      DB02_PASS: REDACTED

      ...
    volumes:
      - ./volumes/dumps:/backup
      - ./volumes/scripts:/assets/scripts
    networks:
      - db_dumper
    restart: unless-stopped
    logging:
      driver: json-file
      options:
        max-size: "10m"
        max-file: "3"

networks:
  db_dumper:
    driver: bridge
    name: db_dumper

Possible fixes

The image entrypoint shouldn't append stuff to /usr/bin/backup<number>-now, but should replace them instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions