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.

using killact

Discussion in 'General Discussion' started by BigLebowski, Aug 13, 2008.

  1. BigLebowski

    BigLebowski Well-Known Member

    Joined:
    Dec 24, 2007
    Messages:
    75
    Likes Received:
    0
    Trophy Points:
    6
    hi there

    I need to script the deletion of a number of accounts. "killact" is suggested, however when terminating an account manually in WHM I note the use of:

    /scripts/prekillacct
    /scripts/legacypostkillacct
    /scripts/postkillacct

    Are these strictly speaking needed and do they take any parameters? Does anyone know what they do and if/where they are documented please?

    Cheers
    Dude
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    These scripts are called whenever killacct is called.

    Documentation is available at:

    http://www.cpanel.net/support/docs/hooks.htm

    Note that all post- scripts have corresponding pre-scripts. Legacypostkillacct is only provided for legacy purposes and should not be used anymore.
     
  3. BigLebowski

    BigLebowski Well-Known Member

    Joined:
    Dec 24, 2007
    Messages:
    75
    Likes Received:
    0
    Trophy Points:
    6
    many thanks David

    Is there a way to run killact in non-interacitve mode? When I run it, it keeps asking me to confirm deletion. I need to script it.

    Dude
     
  4. HostsVault

    HostsVault Registered

    Joined:
    Aug 14, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Unfortunately you will have to edit the script to do that , I can help you in this gladly.
     
  5. johny_gjx

    johny_gjx Active Member

    Joined:
    Apr 15, 2005
    Messages:
    42
    Likes Received:
    0
    Trophy Points:
    6
    There is a package called expect and most probably you already have it, if you don't you can do
    yum install expect
    or through any package manager this could be installed. after that check:

    man expect
    man autoexpect

    you'd be able to write scripts that can answer to questions that are raised in the middle of their actions, by themselves.
     
  6. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,458
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    No need to use expect or modify the script. Simply pipe the `yes` command to /scripts/killacct:

    Code:
    oot@mundane [/usr/local/cpanel]# yes | /scripts/killacct loop12
    Removing: User: loop12
    Running pre removal script (/scripts/prekillacct)......Done
    Collecting Domain Name and IP......Done
    Killing all processes owned by user......Done
    Cleaning passwd,shadow,group......Done
    Removing User from Group..........Done
    Removing Web Logs......Done
    Removing Crontab......Done
    Removing Virtual Hosts......Done
    Removing PostgreSQL databases and users......Done
    Removing System User......Done
    Removing Group...groupdel: group loop12 does not exist
    ...Done
    Removing DNS Entries...
    ...Done
    Removing Email Setup......Done
    Removing mailman lists......Done
    Removing MySQL databases and users......Done
    Removing remotedomains,secondarymx,localdomains entries......Done
    Removing Counter Data......Done
    Adding ip back to ipaddrpool......Done
    Removing user's cPanel Databases & Updating......Done
    Reloading Services...proftpd: no process killed
    ...Done
    Removing mail and service configs......Done
    Sending Contacts......Done
    Updating internal databases......Done
    Running post removal scripts (/scripts/legacypostkillacct, /scripts/postkillacct)......Done
    Account Removal Complete!!!......Done
    loop12 account removed
    User: loop12
    Domain: looptest12.loop
    Removed Extra Entries from httpd.conf
    looptest12.loop not found in httpd.conf.
    looptest12.loop -> deleted from mundane. 
    
    
    
    
    
    
    Removing /etc/valiases/looptest12.loop
    System has 287 free ips.
    
    Updating ftp passwords for all users
    Ftp password files updated.
    Ftp vhost passwords synced
    loop12 account removed
    
     
  7. johny_gjx

    johny_gjx Active Member

    Joined:
    Apr 15, 2005
    Messages:
    42
    Likes Received:
    0
    Trophy Points:
    6
    nice! had forgotten about shell yes and no commands, even more I just tested piping a list of cPanel usernames to a loop and saw it absolutely did not need even the "yes" command!

    Code:
    cat list | while read me; do /scripts/killacct $me; sleep 1; done
    asked no questions!
     
Loading...

Share This Page