diff options
-rw-r--r-- | docs/man/borg-placeholders.1 | 3 | ||||
-rw-r--r-- | docs/usage/help.rst.inc | 3 | ||||
-rw-r--r-- | src/borg/archiver.py | 3 | ||||
-rw-r--r-- | src/borg/helpers/parseformat.py | 1 |
4 files changed, 10 insertions, 0 deletions
diff --git a/docs/man/borg-placeholders.1 b/docs/man/borg-placeholders.1 index 9f5012015..90a0ff22e 100644 --- a/docs/man/borg-placeholders.1 +++ b/docs/man/borg-placeholders.1 @@ -42,6 +42,9 @@ The (short) hostname of the machine. .B {fqdn} The full name of the machine. .TP +.B {reverse-fqdn} +The full name of the machine in reverse domain name notation. +.TP .B {now} The current local date and time, by default in ISO\-8601 format. You can also supply your own \fI\%format string\fP, e.g. {now:%Y\-%m\-%d_%H:%M:%S} diff --git a/docs/usage/help.rst.inc b/docs/usage/help.rst.inc index 2d5455564..3201dab4f 100644 --- a/docs/usage/help.rst.inc +++ b/docs/usage/help.rst.inc @@ -169,6 +169,9 @@ placeholders: {fqdn} The full name of the machine. +{reverse-fqdn} + The full name of the machine in reverse domain name notation. + {now} The current local date and time, by default in ISO-8601 format. You can also supply your own `format string <https://docs.python.org/3.5/library/datetime.html#strftime-and-strptime-behavior>`_, e.g. {now:%Y-%m-%d_%H:%M:%S} diff --git a/src/borg/archiver.py b/src/borg/archiver.py index 887cb7726..db7738192 100644 --- a/src/borg/archiver.py +++ b/src/borg/archiver.py @@ -1901,6 +1901,9 @@ class Archiver: {fqdn} The full name of the machine. + {reverse-fqdn} + The full name of the machine in reverse domain name notation. + {now} The current local date and time, by default in ISO-8601 format. You can also supply your own `format string <https://docs.python.org/3.5/library/datetime.html#strftime-and-strptime-behavior>`_, e.g. {now:%Y-%m-%d_%H:%M:%S} diff --git a/src/borg/helpers/parseformat.py b/src/borg/helpers/parseformat.py index 3682bf263..83481846b 100644 --- a/src/borg/helpers/parseformat.py +++ b/src/borg/helpers/parseformat.py @@ -183,6 +183,7 @@ def replace_placeholders(text): data = { 'pid': os.getpid(), 'fqdn': socket.getfqdn(), + 'reverse-fqdn': '.'.join(reversed(socket.getfqdn().split('.'))), 'hostname': socket.gethostname(), 'now': DatetimeWrapper(current_time.now()), 'utcnow': DatetimeWrapper(current_time.utcnow()), |