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.

How do I delete inactive accounts?

Discussion in 'General Discussion' started by gedan, May 31, 2009.

  1. gedan

    gedan Registered

    Joined:
    May 31, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    I have three free hostings and need a script to delete dormant accounts.

    Dormant accounts as I believe that the sites did not generate any traffic, or who did not send any content

    There are already thousands of accounts

    Somebody could help me?
     
  2. gedan

    gedan Registered

    Joined:
    May 31, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    There are Many accounts and the section does not appear that such accounts are inactive

    I need a script, preferably in PHP to do this task automatically
     
  3. lehels

    lehels Well-Known Member

    Joined:
    Jul 10, 2006
    Messages:
    90
    Likes Received:
    0
    Trophy Points:
    6
    You could check this script: "chkcpaccts" at:
    cplicensing dot net slash scripts.php

    This should help you track down inactive domains and then erasing them.

    Lehel,
     
  4. pratapsingh

    pratapsingh Active Member

    Joined:
    Mar 20, 2009
    Messages:
    39
    Likes Received:
    0
    Trophy Points:
    6
    You can run this script on your risk please verify the outputs before deleting the accounts.
    =======================================
    :>/root/backupfolders
    :>/root/existing_acctuser
    :>/root/inacctive_account

    ls /backup/cpbackup/weekly | cut -d"/" -f1>> /root/backupfolders
    ls /var/cpanel/users | cut -d"/" -f1 >> /root/existing_acctuser

    for i in `cat /root/backupfolders`;
    do
    count=`grep -c $i /root/existing_acctuser`
    if [ $count == 0 ]
    then
    echo "$i : $count is an inacctive account";
    echo "checking the accounits $i under userdomains $count `grep $i /etc/userdomains`";
    echo $i >> /root/inacctive_account
    fi;
    done

    echo "!!!!!!!!!! WARNING !!!!!!!!!!!!!"
    echo "Do you really want to delete the InAcctive Accounts then press y else any other Key?"
    echo "!!!!!!!!!! WARNING !!!!!!!!!!!!!"
    path="/backup/cpbackup/weekly"
    if [ $1 == y ]
    then
    for i in `cat /root/inacctive_account`;
    do
    echo "Deleting inactive account $i backup from the server"
    rm -rf $path/$i
    done
    fi;
    ======================================

    Same thing you can repeat on daily and monthly.
     
Loading...

Share This Page