""" Daily encrypted backup job — runs the backup.sh script inside the container. The script does: pg_dump | gzip | gpg symmetric AES-256 → /app/backups/ """ import asyncio import structlog logger = structlog.get_logger() async def backup_job() -> None: try: proc = await asyncio.create_subprocess_exec( "bash", "/app/scripts/backup.sh", stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.STDOUT, ) stdout, _ = await proc.communicate() output = stdout.decode().strip() if stdout else "" if proc.returncode == 0: logger.info("backup_complete", output=output) else: logger.error("backup_failed", returncode=proc.returncode, output=output) except Exception as exc: logger.error("backup_error", error=str(exc))