Setting up an automated mySQL / MariaDB backup schedule

Just digging deeper in automating thing, so I made two scripts:

# Define the path to the backup script

# Define the cron job command to run the backup script once a week (every Sunday at midnight)

# Add the cron job to the crontab
(crontab -l 2>/dev/null; echo "$CRON_COMMAND") | crontab -

echo "Backup cron job set up successfully."

And the script that executes the backup every Sunday:

# Define the directory where backup files will be stored

# Ensure the backup directory exists
mkdir -p "$BACKUP_DIR"

# Define the filename for the backup file (include date in the filename)
BACKUP_FILE="$BACKUP_DIR/mysql_backup_$(date +%Y-%m-%d_%H-%M-%S).sql"

# Define the compressed filename

# Define MySQL username and password (replace with your MySQL credentials)

# Dump all databases into a single SQL file
mysqldump -u "$DB_USER" -p"$DB_PASS" --all-databases > "$BACKUP_FILE"

# Add permissions to the backup file
chmod 600 "$BACKUP_FILE"

# Compress the backup file

echo "Database backup completed. Backup stored in: $COMPRESSED_FILE"

To make the script executable:

sudo chmod +x
sudo chmod +x

and run it with

sudo ./


ArchiveBox root issue in UNraid [FIXED]

Short version of:

Archivebox Docker superuser root issues

[!] ArchiveBox should never be run as root!

The INIT line is in case you set up this docker for the first time. If you already have entered the INIT command, I don;t think you have to do it again.

  1. Open the UNraid Terminal
  2. Enter
    cd /data
  3. Enter (Optional, see previous note)
    archivebox init
  4. Enter
    docker exec -it --user archivebox archivebox bash
  5. Enter
    archivebox manage createsuperuser


Credits to “emiliobool” for their comment on April 25, 2021 @