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!

add extra process after account creation.

Discussion in 'General Discussion' started by Domenico, May 1, 2003.

  1. Domenico

    Domenico Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    371
    Likes Received:
    1
    Trophy Points:
    318
    When I create an account in WHM I want bind to be restarted after the account creation. Don't ask me why but it is really needed because otherwise the SIDN (dutch) nameserver check gives an error and you can't register a .nl domain with this error. The error disappears after Bind gets restarted so that's why I want Bind to be restarted another thime after account creation.

    Ehm, is this story clear? :)
    Anyone know where and what I must add ?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. Domenico

    Domenico Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    371
    Likes Received:
    1
    Trophy Points:
    318
    Anyone?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,574
    Likes Received:
    3
    Trophy Points:
    343
    Location:
    Toronto, Ontario Canada
    cPanel Access Level:
    DataCenter Provider
    You would probably need to modify /scripts/wwwacct

    At around the 790 line is where cpanel has completed the majority of the user setup.

    At this point you would want to add the following;

    system("restartsrv bind");

    That should restart bind after the account is created.

    Here is the hitch, if you do not chattr +i the file it will be overwritten every night. If you do chattr it then every so often you would need to compare it to a newer wwwacct file to ensure proper updates.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. PhsyCon

    PhsyCon Member

    Joined:
    May 8, 2003
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    151
    your could write a script to diff the files and email you the output afterupdates..

    then you'd know when to change.. and what to change
     
  5. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    4
    Trophy Points:
    343
    Location:
    ON, Canada
    That's pretty much what I do to monitor my custom wwwacct file.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. Domenico

    Domenico Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    371
    Likes Received:
    1
    Trophy Points:
    318
    Are you willing to share this script with me? :)

    cPanel.net Support Ticket Number:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    4
    Trophy Points:
    343
    Location:
    ON, Canada
    It's pretty simple.

    I make a copy of the original wwwacct script and call it wwwacctunedited, then I make my changes to wwwacct and I have a backup copy of it called wwwacctedited.

    My scripts just compares wwwacctedited to wwwacct and if there is a change, it then compares it to wwwacctunedited to see if the change was just back to normal. If it was just changed back to normal, it automatically replaces my customizations by copying wwwacctedited to wwwacct. If the altered one is not the same as the original, it means something was actually changed by cpanel and I will need to manually re-edit the file to accomodate the updates. My script emails me either way.

    Since the only time this file is changed is when upcp is run, I have my script running 30 minutes after the cpanel update.

    Here's the script. Just put appropriate emails in where I used italics.

    #!/usr/bin/perl

    # script provided by premierwebsitesolutions.com
    # use of this script is free and we are not responsible for it's use
    # if you need help with it, just contact us

    $diff1 = system("cmp /scripts/wwwacct /scripts/wwwacctedited");

    if ($diff1 eq "0") {
    exit;
    }
    else {
    $diff2 = system("cmp /scripts/wwwacct /scripts/wwwacctunedited");
    }

    if ($diff2 eq "0") {
    system("cp -f /scripts/wwwacctedited /scripts/wwwacct");

    $mailprog = "/usr/sbin/sendmail";

    # Open The Mail Program
    open(MAIL,"|$mailprog -t");
    print MAIL "Content-Type: text/html; charset=iso-8859-1\n";

    print MAIL "To: some email\n";
    print MAIL "From: some email\n";

    print MAIL "Subject: wwwacct file changed and restored\n";

    print MAIL "<b>The wwwacct file was changed back to the original and has been automatically replaced with the edited version.</b><br><br>\n\n";

    close (MAIL);

    }

    if ($diff2 ne "0") {

    $mailprog = "/usr/sbin/sendmail";

    # Open The Mail Program
    open(MAIL,"|$mailprog -t");
    print MAIL "Content-Type: text/html; charset=iso-8859-1\n";

    print MAIL "To: some email\n";
    print MAIL "From: some email\n";

    print MAIL "Subject: wwwacct file changed\n";

    print MAIL "<b>The wwwacct file has been changed and no longer matches the original file. You will need to redo your custom work.</b><br><br>\n\n";

    close (MAIL);

    }
     
    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