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.

Script to automatically suspend inactive accounts

Discussion in 'Workarounds and Optimization' started by ziGuy, Jan 1, 2015.

  1. ziGuy

    ziGuy Registered

    Joined:
    Jan 1, 2015
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    /https://github.com/ziGuy/cPanel

    This script will go through all cpanel accounts and check whether
    each account is active according to dns records (a and mx), resolving from
    an external dns server.
    Please note that if an account is using an external redirection
    like cloudflare, it will be considered as inactive.
    ns records are NOT being checked.
    In the end of the scanning you can choose to automatically suspend all,
    inactive accounts, and in the next run you can choose to terminate those.
    You can also terminate only suspended accounts that have been suspended 3 month ago.

    cpInactiveAcct.png
     
    #1 ziGuy, Jan 1, 2015
    Last edited by a moderator: Jan 4, 2015
  2. MilesWeb

    MilesWeb Well-Known Member
    PartnerNOC

    Joined:
    May 23, 2012
    Messages:
    174
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Thank you for the share. Cheers.

    BTW, will it check for the Addon domains as well ? At times, the main domain does not resolve to server IP whereas the Addon domain do point to server IP address.
     
  3. ziGuy

    ziGuy Registered

    Joined:
    Jan 1, 2015
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    My pleasure.

    Yes it will check for all types: subdomains, addon domains and parked domains.
    If at least one of the above resolves to one of the server's IP(s), the account will be considered as active account.
     
  4. MilesWeb

    MilesWeb Well-Known Member
    PartnerNOC

    Joined:
    May 23, 2012
    Messages:
    174
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    India
    cPanel Access Level:
    Root Administrator
    That's a great feature. Worth giving it a try. Will post output of the plugin once I try it. Will help during the server audits.
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    In addition to the custom script, you may also want to submit a feature request to have this functionality included with cPanel natively:

    Submit A Feature Request

    Thank you.
     
Loading...

Share This Page