Script Provisioning Addon
Script provisioning addon is a plugin for Script Provisioning module - please refer to the module's documentation first.
The addon is available in Settings → Products & Services → Product Addons → Script Provisioning Addon (and duplicated for each new addon needed)
Configuring the addon
- The plugin is shipped with Script Provisioning module, and once this module is activated, Script Provisioning plugin is available in Product Addons section.
- Proceed to the Connect with App section and configure the settings:
- Check which events should execute a script (ie. terminate/create etc.)
- From dropdown list select which script to execute (you should create scripts first)
- Provide arguments that script should be executed with, here you can use variables (up-to-date list is available in product configuration):
Note about arguments:
All arguments will be escaped before execution for additional security.
System requirements & security precautions
Precautions below are for enterprise version installed using auto-install script. If your HostBill is installed on different user/paths - refer also to section Non-enterprise install
- Make sure that /home/hostbill/scripts directory exists, and belongs to user hostbill
- This module relies on php proc_open and exec functions, that are by default disabled in php.ini's disable_functions directive, to use it:
- Use HostBill Queue module that runs tasks in background/trough cron, and with that can make use of different php settings, or
- (not advised) remove proc_open and exec functions from php.ini disable_functions directive
- Its not advised to use this module on shared environment.
Scripts requirements
- Scripts should be placed in /home/hostbill/scripts
- Script should be made executable for hostbill user (chmod u+x)
- If possible, use hashbang in your custom scripts
- On success your script should return 0 exit code.
- On failure return any other exit code
- Any script output is logged in related account log on error/success
- Before executing any script, module changes working directory (cwd) to main HostBill scripts directory
Non-Enterise install
By default scripts should be located in /home/hostbill/scripts directory, to use custom dir on other installations, edit includes/config.php file and add lines:
$config = array (); $config [ 'ScriptsDirectory' ] = "/path/to/your/scripts/dir" ; |
Make sure that this directory is not accessible from web (outside of public_html or similar folders)