From a192cbcbd0ab2b6169a66951fe0a44d32f210a33 Mon Sep 17 00:00:00 2001 From: Spitap Date: Mon, 19 Sep 2022 16:40:25 +0200 Subject: [PATCH] Updated doc, default path on conf file --- README.rst | 16 ++++++++-------- modoboa_installer/scripts/backup.py | 7 ++++--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/README.rst b/README.rst index a3a5412..8038ba7 100644 --- a/README.rst +++ b/README.rst @@ -108,30 +108,30 @@ You can start the process as follows:: Then follow the step on the console. -There are also two non-interactive mode: +There are also a non-interactive mode: -1. Silent batch mode +1. Silent mode Command:: - $ sudo ./run.py --backup --sbatch + $ sudo ./run.py --silent-backup -This mode is the silent batch mode, when executed, it will create /modoboa_backup/backup{time} and each time you execute it, it will create a new backup directory with current time. +This mode is the silent batch mode, when executed, it will create /modoboa_backup/ and each time you execute it, it will create a new backup directory with current time. -2. Path batch mode +You can supply a custom path. Command:: - $ sudo ./run.py --backup --batch /path/of/backup/directory + $ sudo ./run.py --silent-backup --backup-path /path/of/backup/directory This mode is the same as silent batch mode, but you provide the path to the backup directory you want. If you want to disable mail backup:: - $ sudo ./run.py --backup --no-mail + $ sudo ./run.py {--backup|--silent-backup} --no-mail-backup -This can be useful for larger instance +This can be useful for larger instance. Restore mode ------------ diff --git a/modoboa_installer/scripts/backup.py b/modoboa_installer/scripts/backup.py index 0b3aa9e..54d9f5a 100644 --- a/modoboa_installer/scripts/backup.py +++ b/modoboa_installer/scripts/backup.py @@ -4,7 +4,6 @@ import os import pwd import shutil import stat -import datetime import sys from .. import database @@ -78,8 +77,10 @@ class Backup: """Setup backup directory.""" if self.silent_backup: if self.backup_path is None: - date = datetime.datetime.now().strftime("%m_%d_%Y_%H_%M") - path = f"./modoboa_backup/backup_{date}/" + if self.config.has_option("backup", "default_path"): + path = self.config.get("backup", "default_path") + else: + path = f"./modoboa_backup/" self.validate_path(path) else: if not self.validate_path(self.backup_path):