Duply/Anwendung: Unterschied zwischen den Versionen

Aus Foxwiki
Wechseln zu:Navigation, Suche
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
 
Zeile 1: Zeile 1:
=== Besachreibung ===
== Aufruf ==
=== Argumente ===
=== Optionen ===
{| class="table table-striped table-hover col1bold col1nowrap"
|-
! Option !! Beschreibung
|-
| --force || passed to duplicity (see commands purge, purgeFull, purgeIncr, cleanup)
|-
| --preview || do nothing but print out generated duplicity command lines
|-
| --disable-encryption || disable encryption, overrides profile settings
|}
 
=== Kommandos ===
{| class="table table-striped table-hover sortable col1bold col1nowrap"
|-
! Option !! Parameter ||Beschreibung
|-
| usage || || get usage help text
|-
| and/or/groupIn/groupOut || || pseudo commands used in batches (see SEPARATORS above)
|-
| create || || creates a configuration profile
|-
| backup || || backup with pre/post script execution (batch: [pre_bkp_post]), full (if full_if_older matches or no earlier backup is found) incremental (in all other cases)
|-
| pre/post || ||execute '<profile>/pre', '<profile>/post' scripts
|-
| bkp || || as above but without executing pre/post scripts
|-
| full || ||force full backup
|-
| incr || || force incremental backup
|-
| list || [<age>] || list all files in backup (as it was at <age>, default: now)
|-
| status || || prints backup sets and chains currently in repository
|-
| verify || [<age>] [--compare-data] || list files changed, since age if given
|-
| verifyPath || <rel_path_in_bkp> <local_path> [<age>] [--compare-data] || list changes of a file or folder path in backup compared to a local path, since age if given
|-
| restore || <target_path> [<age>] || restore the complete backup to <target_path> [as it was at <age>]
|-
| fetch || <src_path> <target_path> [<age>] || fetch single file/folder from backup [as it was at <age>]
|-
| purge || [<max_age>] [--force] || list outdated backup files (older than $MAX_AGE) [use --force to actually delete these files]
|-
| purgeFull || [<max_full_backups>] [--force] || list outdated backup files ($MAX_FULL_BACKUPS being the number of full backups and associated incrementals to keep, counting in reverse chronological order) [use --force to actually delete these files]
|-
| purgeIncr || [<max_fulls_with_incrs>] [--force] || list outdated incremental backups ($MAX_FULLS_WITH_INCRS being the number of full backups which associated incrementals will be kept, counting in reverse chronological order) [use --force to actually delete these files]
|-
| purgeAuto || [--force] || convenience batch wrapper for all purge commands above
* purge, purgeFull, purgeIncr are added if their conf vars were set
* e.g
MAX_AGE=1Y
MAX_FULL_BACKUPS=6
MAX_FULLS_WITH_INCR=3
in profile conf file would result in
[purge_purgeFull_purgeIncr]
|-
| cleanup || [--force] || list broken backup chain files archives (e.g
* after unfinished run) [use --force to actually delete these files]
|-
| changelog || || print changelog / todo list
|-
| txt2man || || feature for package maintainers - create a manpage based on the usage output
* download txt2man from https://mvertes.free.fr/, put it in the PATH and run 'duply txt2man' to create a man page
|-
| version || || show version information of duply and needed programs
|}
 
=== Umgebung ===
=== Rückgabewert ===
 
 
<noinclude>
 
; Anwendung
; Anwendung
; Erstmalige Verwendung (Profilerstellung)
; Erstmalige Verwendung (Profilerstellung)

Aktuelle Version vom 21. September 2026, 14:30 Uhr

Aufruf

Argumente

Optionen

Option Beschreibung
--force passed to duplicity (see commands purge, purgeFull, purgeIncr, cleanup)
--preview do nothing but print out generated duplicity command lines
--disable-encryption disable encryption, overrides profile settings

Kommandos

Option Parameter Beschreibung
usage get usage help text
and/or/groupIn/groupOut pseudo commands used in batches (see SEPARATORS above)
create creates a configuration profile
backup backup with pre/post script execution (batch: [pre_bkp_post]), full (if full_if_older matches or no earlier backup is found) incremental (in all other cases)
pre/post execute '<profile>/pre', '<profile>/post' scripts
bkp as above but without executing pre/post scripts
full force full backup
incr force incremental backup
list [<age>] list all files in backup (as it was at <age>, default: now)
status prints backup sets and chains currently in repository
verify [<age>] [--compare-data] list files changed, since age if given
verifyPath <rel_path_in_bkp> <local_path> [<age>] [--compare-data] list changes of a file or folder path in backup compared to a local path, since age if given
restore <target_path> [<age>] restore the complete backup to <target_path> [as it was at <age>]
fetch <src_path> <target_path> [<age>] fetch single file/folder from backup [as it was at <age>]
purge [<max_age>] [--force] list outdated backup files (older than $MAX_AGE) [use --force to actually delete these files]
purgeFull [<max_full_backups>] [--force] list outdated backup files ($MAX_FULL_BACKUPS being the number of full backups and associated incrementals to keep, counting in reverse chronological order) [use --force to actually delete these files]
purgeIncr [<max_fulls_with_incrs>] [--force] list outdated incremental backups ($MAX_FULLS_WITH_INCRS being the number of full backups which associated incrementals will be kept, counting in reverse chronological order) [use --force to actually delete these files]
purgeAuto [--force] convenience batch wrapper for all purge commands above
  • purge, purgeFull, purgeIncr are added if their conf vars were set
  • e.g
MAX_AGE=1Y
MAX_FULL_BACKUPS=6
MAX_FULLS_WITH_INCR=3

in profile conf file would result in

[purge_purgeFull_purgeIncr]
cleanup [--force] list broken backup chain files archives (e.g
  • after unfinished run) [use --force to actually delete these files]
changelog print changelog / todo list
txt2man feature for package maintainers - create a manpage based on the usage output
version show version information of duply and needed programs

Umgebung

Rückgabewert

Anwendung
Erstmalige Verwendung (Profilerstellung)
duply <Profil> erstellen
Verwendung im Einzel- oder Batch-Modus
duply <profile> <Befehl>[[_|+|-]<Befehl>[_|+|-]...] [<Optionen> ...]
Für Stapel können die bedingten Trennzeichen auch als Pseudo-Befehle geschrieben werden und(+), oder(-)
  • siehe BEISPIELE
  • siehe SEPARATORS

Nicht duply-Optionen werden an duplicity weitergegeben

  • siehe OPTIONS
Alle conf-Parameter können stattdessen auch in der Umgebung definiert werden

Pre- und Post-Skripte

  • Das pre-Skript wird direkt vor dem Backup ausgeführt, das post-Skript direkt nach dem Backup
  • Mit diesen Skripten können beispielsweise Snapshots von LVM-Volumes oder Dumps von SQL Datenbanken gemacht und in das Backup einbezogen werden
  • Die files pre und post müssen im jeweiligen duply Verzeichnis liegen (Bsp.: /home/user/.duply/backup/) und ausführbar sein
  • Werden die pre/post Scripte nicht wie erhofft ausgeführt (beispielsweise bei den Sicherchungs-Methoden "full/incr"), können diese explizit angegeben werden: pre_incr_post
Beispiel

Hier ein Beispiel für ein PRE/POST Skript welches vor dem Backup einen SQL-Dump aller Datenbanken erstellt und diesen nach dem Backup wieder löscht

pre-Datei
/usr/bin/mysqldump --all-databases -u root -ppw > /tmp/sqldump-$(date '+%F')
post-Datei
/bin/rm /tmp/sqldump-$(date '+%F')
PRE/POST SCRIPTS

Useful internal duply variables are exported to the scripts

PROFILE, CONFDIR, SOURCE, TARGET_URL_<PROT|HOSTPATH|USER|PASS>,
GnuPG_<KEYS_ENC|KEY_SIGN|PW>, CMD_ERR, RUN_START,
CMD_<PREV|NEXT> (previous/next command),
CND_<PREV|NEXT> (condition before/after)

The CMD_* variables were introduced to allow different actions according to the command the scripts were attached to e.g. 'pre_bkp_post_pre_verify_post' will call the pre script two times, with CMD_NEXT variable set to 'bkp' on the first and to 'verify' on the second run

  • CMD_ERR holds the exit code of the CMD_PREV

exclude

  • duply arbeitet standardmäßig mit einer Whitelist
  • Um gewisse Verzeichnisse oder Dateien von einem Backup zu inkludieren muss die Datei exclude im duply Verzeichnis erstellt werden
  • Die Syntax erlaubt das Hinzufügen von Verzeichnissen und Dateien mit einem + /pfad/zur/datei
  • Um ein Verzeichnis zu exkludieren muss in der exclude ein - /pfad/zum/Verzeichnis eingefügt werden
  • Zudem erlaubt duply die Verwendung von Wildcards
  • Die hier dargestellte exclude Datei sichert die Verzeichnisse /etc/, /root/, /var/www/ und exkludiert alle anderen Verzeichnisse
+ /etc/
+ /root/
+ /var/www/
- **

Argumente

  • duply bietet eine Vielzahl von Kommandozeilenparametern für die Sicherung und Wiederherstellung von Daten
  • Die gesamte Liste ist in der Manpage von duply zu finden
  • Beim Einsatz von mehreren Parameter werden diese durch einen Unterstrich (_) getrennt
  • Mit /usr/bin/duply /root/.duply/test full_verify_purge --force wird ein volles Backup erstellt, verifiziert und alte Backups gelöscht
  • Backups welche die MAX_AGE überschritten haben werden mit purge angezeigt und durch die zusätzliche Option --force gelöscht
  • Der Befehl /usr/bin/duply /root/.duply/test incr führt ein inkrementelles Backup aus

Beispiele

Profil erstellen

$ duply datenSystem create

don't forget to edit this new conf file

backup 'datenSystem' now

$ duply datenSystem backup

available backup sets

list available backup sets of profile 'datenSystem'

$ duply datenSystem status

outdated backups

list and delete outdated backups of 'datenSystem'
$ duply datenSystem purge --force

restore

restore latest backup of 'datenSystem' to /mnt/restore
$ duply datenSystem restore /mnt/restore
restore /etc/passwd of 'datenSystem' from 4 days ago to /root/pw
$ duply datenSystem fetch etc/passwd /root/pw 4D
$ (see "duplicity manpage", section TIME FORMATS)

a one line batch job on 'datenSystem' for cron execution

$ duply datenSystem backup_verify_purge --force

batch job to run a full backup with pre/post scripts

$ duply datenSystem pre_full_post

Problembehebung

Volume was signed by key X not Y

OSError: Socket is closed

ssh: Exception (client): Signature verification (ssh-rsa) failed
ssh: Traceback (most recent call last):
ssh: File "/usr/local/lib/python3.10/dist-packages/paramiko/transport.py", line 2130, in run
ssh: self.kex_engine.parse_next(ptype, m)
ssh: File "/usr/local/lib/python3.10/dist-packages/paramiko/kex_curve25519.py", line 64, in parse_next
ssh: return self._parse_kexecdh_reply(m)
ssh: File "/usr/local/lib/python3.10/dist-packages/paramiko/kex_curve25519.py", line 130, in _parse_kexecdh_reply
ssh: self.transport._verify_key(peer_host_key_bytes, sig)
ssh: File "/usr/local/lib/python3.10/dist-packages/paramiko/transport.py", line 1942, in _verify_key
ssh: raise SSHException(
ssh: paramiko.ssh_exception.SSHException: Signature verification (ssh-rsa) failed
ssh:
Attempt of put Nr. 1 failed
  • OSError: Socket is closed