Add frontend backup upload and list-based restore with validation.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
# Copyright (c) 2025-2026 马建军. All rights reserved.
|
||||
"""Detached restore worker — survives pm2 stop of the parent web process."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def main(argv: list[str] | None = None) -> int:
|
||||
args = argv if argv is not None else sys.argv[1:]
|
||||
if len(args) != 1:
|
||||
print("usage: python -m modules.backup.restore_job <backup.tar.gz>", file=sys.stderr)
|
||||
return 2
|
||||
archive = Path(args[0]).resolve()
|
||||
if not archive.is_file():
|
||||
print(f"backup not found: {archive}", file=sys.stderr)
|
||||
return 1
|
||||
from modules.backup.db_backup import run_restore_job
|
||||
|
||||
run_restore_job(archive)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user