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 to /scripts/pkgacct with multiple accounts.

Discussion in 'General Discussion' started by mohit, Mar 29, 2007.

  1. mohit

    mohit Well-Known Member

    Joined:
    Jul 12, 2005
    Messages:
    553
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Sticky On Internet
    hi,
    any one with a script to backup 10 or 20 or more accounts using /scripts/pkgacct username in ssh,
    Iam 700 accounts manually, and its taking ages for me to package each account then copy to another server and so on.

    copy account from another server options seems broken even when both server are running same version.

    Code:
    Warning: file location not sent.. guessing.. this may not work ....
    Using the single archive method (/home/cpmove-hidden.tar.gz)!
    Transfer ErrorThe remote server didn't report a correct md5sum of the archive. Please ensure you selected the correct type of remote server. 
    see ya.
    mohit
     
  2. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    You would just need a simple loop script for that to read in the list
    of users on the server and run /scripts/pkgacct against each username

    Code:
    #!/bin/bash
    IFS="$"
    
    cd /var/cpanel/users
    
    find .  -type 'f' | while read CPUSER; do
      echo "Now processing ${CPUSER} ..."
      /scripts/pkgacct ${CPUSER}
    done
    
    All the backups would end up under /home as cpmove files and
    you could just use FTP to transfer them to any server
     
  3. mohit

    mohit Well-Known Member

    Joined:
    Jul 12, 2005
    Messages:
    553
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Sticky On Internet
    hi,
    thanks for the excellent script, but i want to specify the usernames manually, may be 10-15 at a time only.

    can you help me .

    thanks for sparing your time.

    see ya,
    mohit
     
  4. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    Just a slight variation in that case ...

    Create a file named "backup.txt" with the usernames of the accounts
    that you want to backup (one username per line):

    Code:
    #!/bin/bash
    IFS="$"
    
    cat ./backup.txt | while read CPUSER; do
      echo "Now processing ${CPUSER} ..."
      /scripts/pkgacct ${CPUSER}
    done
    
     
  5. ekhwan

    ekhwan Active Member

    Joined:
    Aug 12, 2006
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
Loading...

Share This Page