Feature Spotlight: JetBackup 5 Hooks
In this feature spotlight, we will showcase the custom hooks feature inside of JetBackup 5. This feature gives Server Administrators the ability to execute custom scripts before (pre), or after (post) JetBackup 5 performs a function.
For this post, we will go over how you can take advantage of our Custom Hooks feature to back up the contents of an Account’s ETC folder and include it in a scheduled backup job.
Please note that JetBackup does not officially support backing up the Account Home ETC folder. This script may not work with your specific server configuration and may require additional consideration depending on your server environment, so please proceed at your own risk.
Creating the Hook Script:
First, we will create the bash script that will run as our Pre Backup Account Hook. This Hook Script will run before the Account Backup of all Accounts included in the backup job. We use Rsync to copy the files with no symlinks to a new directory, including it in the backup.
NOTE: JetBackup 5 passes each Hook Event a unique set of ARGS for the Hook Event Script. Here, the Pre Backup Hook Event Script uses the following ARGS:
- $1 – Backup Job ID
- $2 – Account ID
- $3 – Account User Name
For more information on what ARGS JetBackup 5 passes to other Hook Events, please visit: JetBackup 5 Hooks Documentation
After creating the Hook Script, be sure to make it executable by running the command chmod +x /Path/to/Hook/Script
Creating the JetBackup 5 Hook:
Now that the Hook Script is ready, we will Create the JetBackup 5 Pre Backup Account Hook. Please navigate to JetBackup 5 -> Hooks -> Create Hook to start. Below is the example configuration we have set for this Pre Backup Account Hook:
NOTE: We selected the specific Backup Job `Accounts with ETC Backups` in this case. If no Backup Jobs are selected, then the hook will apply to all Backup Jobs by default.
Running the Backup Job:
Before running the Backup Job, here is the current tree of the home etc folder we would like to backup:
[root@qa1 etc]# pwd
/home/acct0003/etc
[root@qa1 etc]# tree
.
├── acct0003.com
│ └── testfile
├── cacheid
├── ftpquota
└── testSymLink1 -> /root/testfilelinked
Next, we run the Backup Job and the following is the tree that will exist in the Backup itself:
[root@qa1 .jbetc]# pwd
/BACKUP/DIRECTORY/jetbackup_1_1_######/acct0003_#######/snap.1/homedir/.jbetc
[root@qa1 .jbetc]# tree
.
└── etc
├── acct0003.com
│ └── testfile
├── cacheid
└── ftpquota
2 directories, 3 files
The etc directory now exists in the JetBackup Backup under the hidden directory .jbetc.
We hope you enjoyed this feature spotlight of custom hooks. If you are a Jetbackup user and have taken advantage of the custom hooks feature, please feel free to share your implementation with the rest of the JetApps community at: https://forum.jetapps.com .
Start your FREE trial
of Jetbackup Today!
Get Started Now!
No credit card required.
Install Jetbackup in minutes.
Latest Posts
Categories
Archive
- December 2024
- November 2024
- October 2024
- September 2024
- August 2024
- July 2024
- May 2024
- April 2024
- February 2024
- January 2024
- December 2023
- November 2023
- October 2023
- August 2023
- July 2023
- April 2023
- January 2023
- August 2022
- May 2022
- March 2022
- January 2022
- December 2021
- November 2021
- October 2021
- September 2021
- August 2021
- July 2021
- June 2021
- May 2021
- March 2021
- February 2021
- January 2021
- December 2020
- October 2020
- August 2020
- April 2020
- March 2020
- February 2020
- January 2020
- December 2019
- November 2019
- September 2019
- August 2019
- July 2019
- June 2019
- April 2019
- March 2019
- January 2019
- December 2018
- November 2018
- October 2018
- September 2018
- August 2018
- May 2018
- April 2018
- March 2018
- February 2018
- January 2018
- December 2017
- November 2017