From 9ade6b33deffdfccfe742e82f06a4fabf9fd7790 Mon Sep 17 00:00:00 2001
From: Axel Hahn <ax2002@gmx.net>
Date: Fri, 7 Oct 2022 20:04:06 +0200
Subject: [PATCH] add docs

---
 docs/50_Hooks.md | 49 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 docs/50_Hooks.md

diff --git a/docs/50_Hooks.md b/docs/50_Hooks.md
new file mode 100644
index 0000000..535ee0a
--- /dev/null
+++ b/docs/50_Hooks.md
@@ -0,0 +1,49 @@
+# Introduction
+
+Hooks are points during the backup process where you can execute custom scripts.
+
+All hooks are located in the `./hooks/` directory.
+
+We have hooks "before" a step starts and "afterwards". 
+
+## List of hooks
+
+In the IML Backup exist the following hooks
+
+| Hook                     | where        | description
+|---                       |---           |---
+| 10-before-backup         | backup.sh    | at the beginning of the backup 
+| 12-before-db-service     | localdump.sh | before starting a backup of a backup type (mysql, sqlite, ...)
+| 14-before-db-dump        | unused
+| 16-after-db-dump         | unused
+| 18-after-db-service      | localdump.sh | after finishing a database type
+| 20-before-transfer       | transfer.sh  | before starting transfer of all directories
+| 22-before-folder-transfer| transfer.sh  | before starting transfer of a single directory
+| 24-after-folder-transfer | transfer.sh  | after transfer of a single directory
+| 26-after-prune           | transfer.sh  | after pruning data
+| 28-after-verify          | transfer.sh  | after verifying data
+| 30-post-backup           | transfer.sh  | after all backup steps
+
+## Subdirs of a hook dir
+
+Below all hook directories have the subdirectory "always": `./hooks/[Name-of-hook]/always/`
+
+### "before" actions
+
+They don't know an execution status of something. They can execute only scripts that are located in "always" subdirectory.
+
+### "after" actions
+
+The "afterwards" added hooks know the execution status of the last action. that's why in the hook directory additionally we have the subdirs 
+
+* `./hooks/[Name-of-hook]/on-ok/`
+* `./hooks/[Name-of-hook]/on-error/`
+
+If the exitcode of the last action was 0 (zero) then the scripts in the "on-ok" folder will be handled.
+If the exitcode was non-zero - the scripts in the "on-error" folder.
+
+After execution of the scripts of "on-ok" or "on-error" additionally the found scripts of "always" will be executed.
+
+### What will be executed?
+
+When processing a hook all files will be sorted in alphabetic order. Files starting with a dot will be ignored. Each found executable file will be executed.
-- 
GitLab