Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

postwwwacct script not running

Discussion in 'cPanel Developers' started by dansgalaxy, Apr 14, 2011.

  1. dansgalaxy

    dansgalaxy Well-Known Member

    Joined:
    Jan 29, 2007
    Messages:
    91
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    Reading, UK
    cPanel Access Level:
    Root Administrator
    I have created a small postwwwacct script to run add Domain Keys etc automatically but it doesn't appear to be running.

    the /scripts/postwwwacct file contains:
    Code:
    #!/usr/bin/perl
    # This code automatically adds domain keys after account creation.
    my %OPTS = @ARGV;
    my $user = $OPTS{’user’};
    /usr/local/cpanel/bin/domain_keys_installer $user
    /usr/local/cpanel/bin/spf_installer $user
    
    It's owned by root & perms are 755.

    Any ideas?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,608
    Likes Received:
    32
    Trophy Points:
    238
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    If you try to run your script in command line using /scripts/postwwwacct, it is going to fail with this error:

    Code:
    # /scripts/postwwwacct
    Unrecognized character \xE2 at /scripts/postwwwacct line 4.
    I would advise changing the script to the following, which I tested and it does work:

    Code:
    #!/usr/bin/perl
    
    my %OPTS = @ARGV;
    $ENV{USER} = "$OPTS{'user'}";
    system q(/usr/local/cpanel/bin/domain_keys_installer $USER);
    system q(/usr/local/cpanel/bin/spf_installer $USER);
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. dansgalaxy

    dansgalaxy Well-Known Member

    Joined:
    Jan 29, 2007
    Messages:
    91
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    Reading, UK
    cPanel Access Level:
    Root Administrator
    Thanks a lot Tristan, seems to be working fine now :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice