Script to automatically suspend inactive accounts

ziGuy

Registered
Jan 1, 2015
1
0
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
 
Last edited by a moderator:

MilesWeb

Well-Known Member
PartnerNOC
May 23, 2012
173
2
68
India
cPanel Access Level
Root Administrator
Twitter
/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.

View attachment 26031
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.
 

ziGuy

Registered
Jan 1, 2015
1
0
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.
 

MilesWeb

Well-Known Member
PartnerNOC
May 23, 2012
173
2
68
India
cPanel Access Level
Root Administrator
Twitter
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.
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.