The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

postwwwacct does not run

Discussion in 'cPanel Developers' started by trgdl, Mar 8, 2012.

  1. trgdl

    trgdl Registered

    Joined:
    Feb 27, 2012
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    DataCenter Provider
    Hi,
    I'd like to use a postwwwacct script to obtain the user data when an account is created.
    I created the script and placed it as /scripts/postwwwacct
    To test the script I simply let it create a file in the /scripts/ directory.
    The script is executable as root as I tested the script successfully as root via SSH.
    However, when I "Create a new Account" in WHM the script is not run, as the test file is not created.

    I also added some testing code to /scripts/wwwacct and it doesn't seem to run upon account creation.
    Somebody has idea what might be the problem there?

    Any help is greatly appreciated!


    Here's the script (I tried php and perl):
    WHM Version: WHM 11.30.6 (build 4)
    cPanel Version: 11.30.6 (build 4)
     
    #1 trgdl, Mar 8, 2012
    Last edited: Mar 8, 2012
  2. KostonConsulting

    KostonConsulting Well-Known Member

    Joined:
    Jun 17, 2010
    Messages:
    255
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    San Francisco, CA
    cPanel Access Level:
    Root Administrator
    If the script is chmod +x, then it should run. However, I'd recommend using the new cPanel Standardized Hooks system rather than /scripts/postwwacct. The new system allows for multiple hooks at each insertion point (function) and has a debug system.

    Basic Usage | Standardized Hooks


    Create a hooks.pl defining your hook:

    Code:
    #!/usr/bin/perl
    
    print << "EOM";
        [
            {
                "namespace": "Whostmgr",
                "function": "Accounts::Create",
                "stage": "post",
                "hook": "/location/to/your/postwwwacct"
            },
        ]
    EOM
    


    Then add your script hook with:

    /usr/local/cpanel/bin/manage_hooks add script hooks.pl



    Then, you can add debughooks=2 to /var/cpanel/cpanel.config and run /usr/local/cpanel/whostmgr/bin/whostmgr2 --updatetweaksettings.

    After that, you will see all the hook information and error output in /usr/local/cpanel/logs/error_log
     
Loading...

Share This Page