m5-1000 Posted February 6, 2014 Share Posted February 6, 2014 Hi, I'm new to whmcs and am currently looking to automate server provisioning once a transaction has been processed. I'm currently in a testing phase, so my product is "free" at the moment. The product includes the following information; -"Product name" -"Operating System" -"Root Password" I would like to take this info and pass it to another server. The other server is running tcl/expect and will do the actuall provisioning. All I need to do is pass the product,operating system, and password as a command to the other server. I have downloaded the ModuleDevKit and read about hooks, but I am really unsure where to go with this? I have bash,tcl, and expect skills as well as modurate php and perl skills, enough to modify php and perl. I'm wondering if anyone has successfully done this before or if someone can point me in the right direction. Any help is appreciated. Thank you 0 Quote Link to comment Share on other sites More sharing options...
jclarke Posted February 6, 2014 Share Posted February 6, 2014 This can be done with a provisioning module. The follow page does a better job of explaining how to write a provisioning module then the dev kit. http://docs.whmcs.com/Provisioning_Module_Developer_Docs 0 Quote Link to comment Share on other sites More sharing options...
m5-1000 Posted February 7, 2014 Author Share Posted February 7, 2014 Thanks Joe, I read through the link. Unfortunately I wasn't able to make heads or tails of any of it. The update function looks like something I could use; function mymodule_UsageUpdate($params) { $serverid = $params['serverid']; $serverhostname = $params['serverhostname']; $serverip = $params['serverip']; $serverusername = $params['serverusername']; $serverpassword = $params['serverpassword']; $serveraccesshash = $params['serveraccesshash']; $serversecure = $params['serversecure']; # Run connection to retrieve usage for all domains/accounts on $serverid # Now loop through results and update DB foreach ($results AS $domain=>$values) { update_query("tblhosting",array( "diskused"=>$values['diskusage'], "dislimit"=>$values['disklimit'], "bwused"=>$values['bwusage'], "bwlimit"=>$values['bwlimit'], "lastupdate"=>"now()", ),array("server"=>$serverid,"domain"=>$values['domain'])); } } Where it loggs into the external server and enters the command; [root@Server] ./command [serverProduct] [CentOS] [RootPASSword] I'm thinking I could take the variables in the above code and use it in php expect? I'm just really unsure about the intended usage of the above code? How does it and what other code (if any) actually executes the above php? Just to add - With my current product, it sends me a WHMCS New Order Notification with the variables I need to send to the new server. I'm wondering if I can sort of use the same idea as the email template but rather send the command and execute it on the other server. I hope this makes sense, -Thanks- 0 Quote Link to comment Share on other sites More sharing options...
progere Posted April 3, 2014 Share Posted April 3, 2014 Hello m5-1000, Have you found better information about provisioning modules? I'm also trying to write my own, but can't seem to find adequate information or at least a provision module example to work with. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.