yeboyebo-backup-tools
Herramienta de backup PostgreSQL multiplataforma (Linux + Windows) con montaje remoto, replicacion, test de integridad y alertas por email.
Instalacion
pip install yeboyebo-backup-tools
# Opcional: logging remoto a Grafana Loki
pip install yeboyebo-backup-tools[loki]
Uso rapido
# Backup de todas las BBDD listadas en lista.txt
backup-tools db dump lista.txt
backup-tools -v db dump lista.txt # con log detallado
backup-tools -vv db dump lista.txt # con log muy detallado
# Restaurar el backup mas reciente de cada BBDD
backup-tools db restore lista.txt
# Dump + restore en servidor replica
backup-tools db replicate lista.txt
# Test de integridad: restaura cada backup en BBDD temporal y verifica
backup-tools db test lista.txt
# Sincronizar backups a NAS / disco remoto (ultimas 12h)
backup-tools file remote /mnt/nas //192.168.1.200/backups
backup-tools file remote /mnt/nas //192.168.1.200/backups 24 # ultimas 24h
# Sincronizar las copias mas recientes (sync_copies) a un NAS Synology por SMB
backup-tools config sync_copies 3
backup-tools file sync /mnt/synology //192.168.1.200/backups lista.txt
# Informe diario por email: ficheros generados en las ultimas 24h
backup-tools resume
# Monitorizar conectividad (envia email si no responde)
backup-tools alive 192.168.1.1
# Gestion de parametros de configuracion
backup-tools config server_name MI_SERVIDOR
backup-tools config user_db postgres true # true = ofuscar valor
# Version
backup-tools version
Acciones
| Accion | Argumentos | Descripcion |
|---|---|---|
db dump |
lista.txt |
Vuelca cada BBDD, comprime con gzip, verifica tamano minimo |
db restore |
lista.txt |
Restaura el backup mas reciente de cada BBDD |
db replicate |
lista.txt |
Dump local + restore en servidor replica (replicate_host_db) |
db test |
lista.txt |
Restaura en BBDD temporal, comprueba integridad, envia email |
file remote |
dir dispositivo [horas] |
Copia backups recientes a NAS/CIFS |
file sync |
dir dispositivo lista.txt |
Sincroniza las sync_copies copias mas recientes de cada BBDD de lista.txt a un NAS (Synology/SMB); el destino queda como espejo de esa seleccion |
resume |
(sin args) | Informe diario por email de backups generados |
alive |
host |
Ping a un host. Si falla, envia alerta por email |
config |
param valor [true] |
Establece parametro en config.ini. true = ofuscar |
version |
(sin args) | Imprime la version |
Configuracion
El fichero config.ini se busca en este orden:
- Variable de entorno
BACKUP_TOOLS_CONFIG ~/.config/backup_tools/config.ini(XDG, recomendado)config.inijunto al modulo (legado)
Parametros principales:
| Parametro | Default | Descripcion |
|---|---|---|
days_alive |
20 |
Dias de retencion de backups |
local_folder_backups |
/backups |
Directorio donde se almacenan los backups |
host_db |
127.0.0.1 |
Host PostgreSQL |
port_db |
5432 |
Puerto PostgreSQL |
user_db |
— | Usuario PostgreSQL (ofuscado) |
pass_db |
— | Contrasena PostgreSQL (ofuscada) |
replicate_host_db |
— | Host replica (para db replicate) |
user_email |
— | Cuenta Gmail para envio de alertas |
pass_email |
— | Contrasena Gmail (ofuscada) |
list_mails |
— | Destinatarios de alertas (separados por coma) |
current_copies |
1 |
Nº de backups recientes en carpeta currents/ |
sync_copies |
1 |
Nº de backups recientes por BBDD a sincronizar con file sync |
min_size |
5000 |
Tamano minimo en bytes (alerta si es menor) |
loki_url |
(monitor.yeboyebo.es) | Endpoint Loki para logging remoto |
Requisitos
- Python >= 3.8
pg_dump,psql(PostgreSQL client tools)- Linux:
mount/mount.cifs(solo parafile remote) - Sin dependencias externas de sistema para
tar,ping,find,touch(todo stdlib Python)
Compatibilidad Windows
Desde v1.1. Particularidades:
- Montaje:
net useen vez demount/mount.cifs niceno disponible (se ignora)ping -nen vez deping -c- Compresion via
tarfile(stdlib), no requieretarexterno - Programar tareas con Task Scheduler en vez de cron
Ejemplo crontab
# Backup diario 3:17 AM
17 3 * * * cd /opt/backup_tools && backup-tools db dump lista.txt
# Replica a contingencia 5:17 AM
17 5 * * * cd /opt/backup_tools && backup-tools db replicate lista.txt
# Test integridad domingos 7:17 AM
17 7 * * 0 cd /opt/backup_tools && backup-tools db test lista.txt
# Informe diario 8:17 AM
17 8 * * * cd /opt/backup_tools && backup-tools resume
# Ping cada 30 min
*/30 * * * * cd /opt/backup_tools && backup-tools alive 192.168.1.1
Metadata
Release files for yeboyebo-backup-tools 1.3.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| yeboyebo_backup_tools-1.3.7.tar.gz | 19.0 kB | Without provenance | Details for yeboyebo_backup_tools-1.3.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yeboyebo_backup_tools-1.3.7-py3-none-any.whl | Python 3 | none | any | Details for yeboyebo_backup_tools-1.3.7-py3-none-any.whl |
Total release size: 39.2 kB
Release files / yeboyebo_backup_tools-1.3.7.tar.gz
| Download URL | yeboyebo_backup_tools-1.3.7.tar.gz |
|---|---|
| Size | 19.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9db4dc09461f4e3a79e86d162a3043aae676ad9ddf706753f435b5fe1bf0b162
|
|
BLAKE2b-256 checksum How to use checksums |
52ad2aac0f0d29915f9040f1e5645df430f2457244966d5bf483771f944d5c78
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.14.8
|
Release files / yeboyebo_backup_tools-1.3.7-py3-none-any.whl
| Download URL | yeboyebo_backup_tools-1.3.7-py3-none-any.whl |
|---|---|
| Size | 20.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b97a8a5c39156f554be93253ab9d59881f056829ad0be0518b591b8c376d3ee4
|
|
BLAKE2b-256 checksum How to use checksums |
10bf98315ba8ae1dce5bcf7ef415fab526d7a8127dcffae3e5d8f46fda1086de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.14.8
|
Security for yeboyebo-backup-tools 1.3.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.