In this feature spotlight we will take a closer look at the custom hooks feature inside of JetBackup. This feature gives server admins the ability to add their own custom scripts either pre (before) or post (after) every major JetBackup command function. Hooks can be used to run status checks, augment JetBackup command functions or abort them altogether if the requirements of the hook are not met.

It is not uncommon for server admins to backup their cPanel accounts to mountable folders using NFS, EXT, iSCSI, or XFS mounted disks (as long as it is an external hard drive). Upon completing a backup job, in order to increase the security of the data, server admins will unmount the drive while it is not in use.

To our knowledge, there is no out-of-the-box solution that allows you to mount and unmount traditional cPanel backups. However, utilizing Jetbackup’s custom hooks feature you now have the power to do it!

The following is a real life example of how a JetBackup user setup custom hooks to achieve this mount/unmount functionality within their backup system. Please note that this is not officially supported by JetBackup. Also, we do not know your specific server configuration, so please proceed with caution at your own risk.

First, we will presume your mountable drive for backups uses the /backup folder. Also, it is important to note that this implementation will only work on JetBackup versions 3.3 and up.

 


The above image shows the mounted /backup folder on the server.

 


In the image above, you will see a total of 14 hook points that will execute a mount / unmount command for any related JetBackup action that requires access to this backup folder: Backup, Clone, Snapshots, Restore, Downloads, Cron Jobs, and Reindex. While you can use a simple mount / unmount command like “unmount /backup”, this JetBackup user decided to use external bash scripts for more validation to have the ability to take action in the case an error arose.

 

Here is an example of the pre hook mount script ‘/ofir/scripts/mount.sh’:

Here is an example of the post hook mount script ‘/ofir/scripts/unmount.sh’

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 .