Skip to content
Snippets Groups Projects
Commit 6d8b62cd authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

update hooks

parent f2787629
No related branches found
No related tags found
1 merge request!885814 migrate repo to v2 - rename hooks
......@@ -13,19 +13,19 @@ 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
At the beginning the startup hook (10-before-backup) and the post hook (30-post-backup) for triggering a message might be the most common to use.
| 100-before-backup | backup.sh | at the beginning of the backup
| 200-before-db-service | localdump.sh | before starting a backup of a backup type (mysql, sqlite, ...)
| 210-before-db-dump | unused
| 220-after-db-dump | unused
| 230-after-db-service | localdump.sh | after finishing a database type
| 300-before-transfer | transfer.sh | before starting transfer of all directories
| 310-before-folder-transfer| transfer.sh | before starting transfer of a single directory
| 320-after-folder-transfer | transfer.sh | after transfer of a single directory
| 330-after-prune | transfer.sh | after pruning data
| 340-after-verify | transfer.sh | after verifying data
| 400-post-backup | transfer.sh | after all backup steps
At the beginning the startup hook (100-before-backup) and the post hook (400-post-backup) for triggering a message might be the most common to use.
## Subdirs of a hook dir
......@@ -49,37 +49,37 @@ After execution of the scripts of "on-ok" or "on-error" additionally the found s
```txt
> tree -d hooks/
hooks/
|-- 10-before-backup
|-- 100-before-backup
| `-- always
|-- 12-before-db-service
|-- 200-before-db-service
| `-- always
|-- 14-before-db-dump
|-- 210-before-db-dump
| `-- always
|-- 16-after-db-dump
|-- 220-after-db-dump
| |-- always
| |-- on-error
| `-- on-ok
|-- 18-after-db-service
|-- 230-after-db-service
| |-- always
| |-- on-error
| `-- on-ok
|-- 20-before-transfer
|-- 300-before-transfer
| `-- always
|-- 22-before-folder-transfer
|-- 310-before-folder-transfer
| `-- always
|-- 24-after-folder-transfer
|-- 320-after-folder-transfer
| |-- always
| |-- on-error
| `-- on-ok
|-- 26-after-prune
|-- 330-after-prune
| |-- always
| |-- on-error
| `-- on-ok
|-- 28-after-verify
|-- 340-after-verify
| |-- always
| |-- on-error
| `-- on-ok
`-- 30-post-backup
`-- 400-post-backup
|-- always
|-- on-error
`-- on-ok
......@@ -96,9 +96,9 @@ When processing a hook all files will be sorted in alphabetic order. Files start
Before the backup starts we want to update some local information that we want to put as latest information.
I have a script that gets the list of installed linux packages as a textfile. If my system is damaged and I need to reinstall it this list will help me to reinstall all applications and libraries.
If my bash script that does the job is `/home/axel/scripts/list_packages.sh` ... and we let it run on each start of the backup. That's why we use the *10-before-backup* hook:
If my bash script that does the job is `/home/axel/scripts/list_packages.sh` ... and we let it run on each start of the backup. That's why we use the *100-before-backup* hook:
Create a file named *hooks/10-before-backup/always/10_list_packages.sh* which has the content:
Create a file named *hooks/100-before-backup/always/10_list_packages.sh* which has the content:
```sh
#!/usr/bin/env bash
......@@ -107,8 +107,8 @@ Create a file named *hooks/10-before-backup/always/10_list_packages.sh* which ha
If you have the installation in a user directory keep in mind that the backup runs as root. Set executable permissions for root. If owner and group is your user then set exection permissions for the world: 0755:
```sh
> chmod 0755 hooks/10-before-backup/always/10_list_packages.sh
> ls -l hooks/10-before-backup/always
> chmod 0755 hooks/100-before-backup/always/10_list_packages.sh
> ls -l hooks/100-before-backup/always
total 4
-rwxr-xr-x 1 axel axel 79 Oct 7 22:36 10_get_installed_packages.sh
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment