Updated doc, default path on conf file

This commit is contained in:
Spitap
2022-09-19 16:40:25 +02:00
parent 5bed9655ea
commit a192cbcbd0
2 changed files with 12 additions and 11 deletions

View File

@@ -108,30 +108,30 @@ You can start the process as follows::
Then follow the step on the console. 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:: Command::
$ sudo ./run.py --backup --sbatch <your domain> $ sudo ./run.py --silent-backup <your domain>
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:: Command::
$ sudo ./run.py --backup --batch /path/of/backup/directory <your domain> $ sudo ./run.py --silent-backup --backup-path /path/of/backup/directory <your domain>
This mode is the same as silent batch mode, but you provide the path to the backup directory you want. 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:: If you want to disable mail backup::
$ sudo ./run.py --backup --no-mail <your domain> $ sudo ./run.py {--backup|--silent-backup} --no-mail-backup <your domain>
This can be useful for larger instance This can be useful for larger instance.
Restore mode Restore mode
------------ ------------

View File

@@ -4,7 +4,6 @@ import os
import pwd import pwd
import shutil import shutil
import stat import stat
import datetime
import sys import sys
from .. import database from .. import database
@@ -78,8 +77,10 @@ class Backup:
"""Setup backup directory.""" """Setup backup directory."""
if self.silent_backup: if self.silent_backup:
if self.backup_path is None: if self.backup_path is None:
date = datetime.datetime.now().strftime("%m_%d_%Y_%H_%M") if self.config.has_option("backup", "default_path"):
path = f"./modoboa_backup/backup_{date}/" path = self.config.get("backup", "default_path")
else:
path = f"./modoboa_backup/"
self.validate_path(path) self.validate_path(path)
else: else:
if not self.validate_path(self.backup_path): if not self.validate_path(self.backup_path):