Hooks

From Virtualizor Wiki
Jump to: navigation, search

Overview

Hooks enable the admin to modify certain aspects of the task being done. There are some Hooks in Virtualizor that you can take advantage of :

Hooks directory is located at :

/usr/local/virtualizor/hooks/


after_createvps

  • This hook will be executed after the VPS has been created but not started.
  • Create after_createvps.php in hooks folder and write your code in the __after_createvps() function.
function __after_createvps($vps){

    // Write your code here. e.g. You can add an additional NIC to the VPS configuration file if you wanted.

}


after_config_write

  • This hook will be executed after the VPS Configuration is created or edited.
  • Create after_config_write.php in hooks folder and write your code in the __after_config_write() function.
function __after_config_write($vps){

    // Write your code here. e.g. You can add additional parameters in the config file of the the VPS.

}

after_deletevps

  • This hook will be executed after the VPS is deleted.
  • Create after_deletevps.php in hooks folder and write your code in the __after_deletevps() function.
function __after_deletevps($vps){

    // Write your code here. e.g. You can add additional parameters in the config file of the the VPS.

}