Phelms215

Member
Aug 27, 2007
6
0
51
Hey Guys,

I have the script below.. right now its just a basic test to get the postwwwacct to run..its one of a few scripts I am working on and sadly having trouble. The script runs perfectly when called via ssh but via WHM it just doesn't run though the green checkbox is the. I checked permissions and the file is in /usr/local/cpanel/scripts . . . if anyone has any advice that would be amazing.. thanks!

Code:
#!/usr/bin/php-cgi -q 
<?php
$ourFileName = "testFile.txt";
$ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
fclose($ourFileHandle);
?>
 

sirdopes

Well-Known Member
PartnerNOC
Sep 25, 2007
141
0
66
It is probably running but not creating the file testFile.txt in the spot that you are expecting. Does it work if you specify the full path?
 

Phelms215

Member
Aug 27, 2007
6
0
51
Hey,

I was able to get it done.. I had a typo in my script that wasn't referencing part of it from when cpanel was calling the script. Though when I called from the directory it worked fine. It is wroking now. Thanks Again!

I have 1 last question, is there a script that runs when cpanel creates an addon domain, subdomain, ftp user or mysql database? thanks in advance!!!!
 
Last edited:

Phelms215

Member
Aug 27, 2007
6
0
51
Hey I looked into that area but since it's perl it might be a little bit harder for me to edit with PHP. I found function hooks and was attempting to use AddonDomain hook and what I did was created the addaddondomain file in /usr/local/cpanel/hooks/AddonDomain .. is that correct or is there somewhere else I would add it ?
 

morissette

Well-Known Member
May 24, 2009
119
2
66
Austin, TX
cPanel Access Level
Root Administrator
There is not a cPanel hook for use on Addon Domains (See: cPanel & WHM Script Hooks) so you would definitely need to use the custom event handlers as sirdopes pointed out.

You should be able to use:

type => post
module => addondomain
event => addaddondomain

Then you could use Data::Dumper in perl or print_r/varDump in php