Welcome Guest. Please Login or Register  


You are here: Index > Virtualizor - Virtual Server Control Panel > General Support > Topic : Hooks File



Threaded Mode | Print  

 Hooks File (7 Replies, Read 2665 times)
madrooster615
Group: Member
Post Group: Newbie
Posts: 3
Status:
Looking for examples of hook scripts.  For example, there are a few things we want in the config file of each XEN vps.  SO its my guess we need to create an after_createvps.php  and an after_config_write.php file.  or just an after_config_write.php file

If can give some type of basic example of the format of the php code,  the wiki is very basic.

Ideally, they would add a empty text box to each VPS setup that we could add the variables we wanted there for each VPS that was not already configured by the admin.
IP: --   

Hooks File
asim_shaikh
Group: Member
Post Group: Elite Member
Posts: 381
Status:
Hi,

Quote
Looking for examples of hook scripts.  For example, there are a few
things we want in the config file of each XEN vps.  SO its my guess we
need to create an after_createvps.php  and an after_config_write.php
file.  or just an after_config_write.php file



after_config_write.php  is enough If you just want to make changes inside the config file of the VPS.

Quote
If can give some type of basic example of the format of the php code,  the wiki is very basic.


Ideally, they would add a empty text box to each VPS setup that we
could add the variables we wanted there for each VPS that was not
already configured by the admin.


Do you mean to add some custom configuration for each XEN VPS after the configuration is written by virtualizor ?


-----------------------
Regards,
Virtualizor Team
http://www.virtualizor.com
IP: --   

Hooks File
madrooster615
Group: Member
Post Group: Newbie
Posts: 3
Status:
Quote From : asim_shaikh August 5, 2015, 11:55 am
Hi,

after_config_write.php  is enough If you just want to make changes inside the config file of the VPS.


So do we just go
PHP Code

 function __after_createvps($vps){
 
    
// Write your code here. e.g. You can add an additional NIC to the VPS configuration file if you wanted.
    
echo "varible1 = blah";
    echo 
"varible2 = stuff";
    echo 
"varible3 = "junk";
 } 




Quote From : asim_shaikh August 5, 2015, 11:55 am

Do you mean to add some custom configuration for each XEN VPS after the configuration is written by virtualizor ?


Idealy in the web admin of Virtualizor say under the advance section when setting up or editing a VPS, there would be a generic text box that we could freehand type extra variables for that particular vps we wanted in the config file. 

That way when the VPS had any changes made to it through either web portal, those changes would stick and be specific to that VPS only.
IP: --   

Hooks File
madrooster615
Group: Member
Post Group: Newbie
Posts: 3
Status:
I guess no one has ever used the hooks file to add to the config file in Xen.  After hours of searching, I can not find one working example.
IP: --   

Hooks File
asim_shaikh
Group: Member
Post Group: Elite Member
Posts: 381
Status:
Hi,

You use a similar code like below to edit/overwrite the config file of a VPS.

function __after_createvps($vps){

    // The Config File Path will differ with the Virtualization technology used:
    For kvm : /etc/libvirt/qemu/vpsid.xml
    For Xen : /etc/xen/auto/vpsid.cfg

    $handle = fopen(<path-to-config-file>/$vps['vpsid'].<xml/cfg>, "r+");
 

   
// Write your code here for Editing the Config File of the VPS.
    ....... 

    .......
   

    fwrite($handle, $file);

    fclose($handle);

}


-----------------------
Regards,
Virtualizor Team
http://www.virtualizor.com
IP: --   

Hooks File
jasonskycom
Group: Member
Post Group: Newbie
Posts: 2
Status:
I want to use "firefox.sh" and other software install new vps.when I create a new vps,then the system will use "after_creatvps.php"  install software what I want.thanks
IP: --   

Hooks File
jasonskycom
Group: Member
Post Group: Newbie
Posts: 2
Status:
Quote From : jasonskycom June 15, 2016, 10:31 am
I want to use "firefox.sh" and other software install new vps.when I create a new vps,then the system will use "after_creatvps.php"  install software what I want.thanks

please tell me how to do.thanks
IP: --   

Hooks File
asim_shaikh
Group: Member
Post Group: Elite Member
Posts: 381
Status:
Quote
I want to use "firefox.sh" and other software install new vps.when I
create a new vps,then the system will use "after_creatvps.php"  install
software what I want.thanks
       


Do you want to install this Software inside windows VPS ?


-----------------------
Regards,
Virtualizor Team
http://www.virtualizor.com
IP: --   

« Previous    Next »

Threaded Mode | Print  



Jump To :


Users viewing this topic
1 guests, 0 users.


All times are GMT. The time now is April 16, 2024, 5:41 am.

  Powered By AEF 1.0.8 © 2007-2008 Electron Inc.Queries: 11  |  Page Created In:0.032