Introduction
Getting started with hooks in Eenos
The Eenos control panel supportsupports hooks, which will help you to integrate any custom scripts or code blockblocks in the middle of Eenos operations.
Eenos supportsupports two type types of hooks Pre Hooks and Post Hooks.
Pre Hooks
The pre pre-hooks will be executed before the operation of a specific function. You should place the hook script in the following folder.
Location : /var/eenos/hooks/FUNCTION_NAME/pre/ , where FUNCTION_NAME is the action function
Example :
Example for a dnsDNS creation pre hook :pre-hook: /var/eenos/hooks/dns/pre/01-dns_sync.py
Post Hooks
The post hooks will be executed after the operation of a specific function .function. You should place the hook script in the following folder.
Location : /var/eenos/hooks/FUNCTION_NAME/post/ , where FUNCTION_NAME is the action function
Example :
Example for a dns creation post hook :hook: /var/eenos/hooks/dns/post/01-dns_sync.py
All hookshook scripts must need execute permission to run the program .program.
Hook Inputs
The Eenos system calls will send the following command line inputs to the hook scripts.
- data
actions ,actions, This is compulsory. - action
CREATECREATE,, UPDATEUPDATE, orDELETE ,DELETE, This is a compulsory - panel
performperforms thehooks ,hooks, wap. rapp oruapp ,uapp, This is a compulsory - domain
- user
.it. It is optional
An example hook action will be look like as follows :
/var/eenos/hooks/dns/pre/01-test.py \
data=eyJ0ZXN0IjoidGVzdCIsImhpIjoiaGVsbG8ifQ== \
action=CREATE \
panel=wap \
domain=fun.com \
user=foo
You may decode the data and process it.
Hook Programming Languages
The Eenos hook supportsupports any programming language or binary. The only requirement is that youryou need to provide execute permission for the hook scripts. We recommend to useusing Python scripts for creating hooks.
Hooks Script Ordering
The Eenos will sort the hook scripts based on the name .name. So if you like to execute multiple hooks ,hooks, please make sure the the hook scriptsscript namenames are in a sorted order. ( eg : 00-pre.py , 01-pre.py, 02-pre.py )