From d6d9fbf6e4a48063a3a7cc46ce7d14e9bf948aad Mon Sep 17 00:00:00 2001 From: Fuxino Date: Sun, 4 Jun 2023 10:16:50 +0200 Subject: [PATCH] Add no-syslog option --- man/simple_backup.1 | 3 +++ simple_backup/simple_backup.py | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/man/simple_backup.1 b/man/simple_backup.1 index c37cc03..9c5f125 100644 --- a/man/simple_backup.1 +++ b/man/simple_backup.1 @@ -56,6 +56,9 @@ Same as rsync option \(aq\-\-checksum\(aq, use checksums instead of mod\-time an .B \-\-remove\-before\-backup Remove old backups (if necessary) before creating the new backup. Useful to free some space before performing the backup. Default behavior is to remove old backups after successfully completing the backup. +.TP +.B \-\-no\-syslog +Don't use systemd journal for logging .SH CONFIGURATION An example configuration file is provided at \(aq/etc/simple_backup/simple_backup.conf\(aq. Copy it to the default location ($HOME/.config/simple_backup) and edit it as needed. diff --git a/simple_backup/simple_backup.py b/simple_backup/simple_backup.py index 191e3d5..df9f24a 100755 --- a/simple_backup/simple_backup.py +++ b/simple_backup/simple_backup.py @@ -252,6 +252,7 @@ def _parse_arguments(): help='Use checksum rsync option to compare files (MUCH SLOWER)') parser.add_argument('--remove-before-backup', action='store_true', help='Remove old backups before executing the backup, instead of after') + parser.add_argument('--no-syslog', action='store_true', help='Disable systemd journal logging') args = parser.parse_args() @@ -297,6 +298,13 @@ def notify(text): def simple_backup(): args = _parse_arguments() + + if args.no_syslog: + try: + logger.removeHandler(j_handler) + except NameError: + pass + inputs, output, exclude, keep = _read_config(args.config) if args.input is not None: