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.

Don't terminate that account...

Discussion in 'General Discussion' started by isnoop, Mar 5, 2004.

  1. isnoop

    isnoop Active Member

    Joined:
    Jun 13, 2003
    Messages:
    27
    Likes Received:
    0
    Trophy Points:
    1
    Safeterminate it!

    Here's a painfully simple shell script that will allow you to automatically make a backup of an account before terminating it.

    Code:
    #!/bin/sh
    #cPanel Safe terminate 
    #Packs up accounts before deleting them
    #http://forums.cpanel.net/showthread.php?s=&threadid=21176
    #usage: safeterminate <account_name>
    
    
    termdir=/home/terminate/
    if test -z $1
    then
       printf "usage: safeterminate <account_name>\n"
       exit
    fi
    
    if test ! -d $termdir
    then
       printf "\n\nSafe terminate asylum directory doesn't exist.  Creating $termdir\n"
       `mkdir $termdir`
    fi
    
    
    printf "Packing up account...\n"
    /scripts/pkgacct $1 
    
    printf "\n\nPackage Complete.  Terminating account\n"
    echo "y" | /scripts/killacct $1 killdns Y 
    
    printf "\n\nAccount killed.  Moving backup\n"
    mv /home/cpmove-$1.tar.gz $termdir 
    
    printf "\n\nSafe terminate process completd.\n"
    Save this code as "safeterminate" in /usr/local/sbin/ and you're good to go.
     
Loading...

Share This Page