Cpanel Hooks and custom configurations

Modifying the source code of cpanel control panel is prohibited by End User License Agreement (EULA)

So how would you implement some custom fucnctionality?

Cpanel provides something called hooks! for this purpose .Hooks are basically files that are checked and if present executed after someĀ  internal cpanel process like account creation,termination etc

I would provide the example of a hook to help you understand how to accomplish some extra tasks if required in a cpanel powered server

This isĀ  a small program and it just prints out the names of the domain being created to a file:

Create the file /scripts/postwwwacct with the following contents

================

#!/usr/bin/perl
my %OPTS = @ARGV;
open (MYFILE, ‘>> /opt/test’);
print MYFILE “$OPTS{’domain’}\n”;
close (MYFILE);

==================

Now whenever you create an account in whm the domain name gets appended in the file /opt/test .This can be further extended by adding more perl/php script or calling scripts from your favourite language from the postwwwacct file

The official Cpanel Hooks Documentation is here : http://www.cpanel.net/support/docs/hooks.htm

Share and Enjoy:
  • Digg
  • Mixx
  • del.icio.us
  • StumbleUpon
  • Facebook
  • TwitThis
  • Technorati
  • Google

Tags: ,

Leave a Reply