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 script not running

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

  1. dansgalaxy

    dansgalaxy Well-Known Member

    Joined:
    Jan 29, 2007
    Messages:
    92
    Likes Received:
    0
    Trophy Points:
    6
    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?
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    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);
     
  3. dansgalaxy

    dansgalaxy Well-Known Member

    Joined:
    Jan 29, 2007
    Messages:
    92
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Reading, UK
    cPanel Access Level:
    Root Administrator
    Thanks a lot Tristan, seems to be working fine now :)
     
Loading...

Share This Page