3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos/modules/services/backup
Erik Arvstedt 3f54dfa475
treewide: fix bash exit handlers
Transform exit handlers of the form
trap cleanup EXIT [INT] [TERM] [QUIT] [HUP] [ERR]
  (where cleanup is idempotent)
to
trap cleanup EXIT

This fixes a common bash antipattern.

Each of the above signals causes the script to exit. For each signal,
bash first handles the signal by running `cleanup` and then runs
`cleanup` again when handling EXIT.
(Exception:  `vscode/*` prevents the second run of `cleanup` by removing
the trap in cleanup`).

Simplify the cleanup logic by just trapping exit, which is always run
when the script exits due to any of the above signals.

Note: In case of borgbackup, the exit handler is not idempotent, but just
trapping EXIT guarantees that it's only run once.
2022-07-02 16:13:12 +02:00
..
automysqlbackup.nix automysqlbackp: fix missing permissions for mysqldump 2022-05-12 13:17:14 +02:00
bacula.nix
borgbackup.nix treewide: fix bash exit handlers 2022-07-02 16:13:12 +02:00
borgbackup.xml
borgmatic.nix nixos/borgmatic: use pkgs.formats.yaml 2022-05-08 01:08:28 -07:00
btrbk.nix nixos/btrbk: inherit lib functions to simplify use-sites 2022-05-12 05:55:39 +08:00
duplicati.nix
duplicity.nix
mysql-backup.nix
postgresql-backup.nix
postgresql-wal-receiver.nix
restic-rest-server.nix
restic.nix nixos/restic: add backup{Prepare,Cleanup}Command options 2022-06-03 11:22:22 -03:00
rsnapshot.nix
sanoid.nix
syncoid.nix
tarsnap.nix
tsm.nix
zfs-replication.nix
znapzend.nix
zrepl.nix