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.

Automatic way to transfer an account?

Discussion in 'General Discussion' started by bleachga, Sep 30, 2005.

  1. bleachga

    bleachga Member

    Joined:
    Nov 14, 2003
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    I have two servers running cpanel. The second server is supposed to function as a backup to the first server in case the first server goes down.

    I'm looking for a way to automatically (e.g. via cron) copy an account from the first server to the second. I can do this manually in WHM on the second server by terminating the account and then choosing "Copy an account from another server with account password".

    Is there a way to do this from a script? Is there an easier way to do this?

    Thanks,

    Brian Leach
     
  2. shaun

    shaun Well-Known Member

    Joined:
    Nov 9, 2001
    Messages:
    698
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    San Clemente, Ca
    Sure, this wouldnt be all that hard at all... you'd just need to write a script to do it.

    the script would need to run /scripts/pkgacct <username> grab the tar.gz from /home/ scp or rsync (via ssh) to the other server (you'll probably want to establish a trust) and then run /scripts/restorepkg <username> on the remote server (if you have a trust you can just send the command via ssh).
     
  3. bleachga

    bleachga Member

    Joined:
    Nov 14, 2003
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Will this work even if the account already exists on the new server? I would want this to run nightly . . .
     
  4. shaun

    shaun Well-Known Member

    Joined:
    Nov 9, 2001
    Messages:
    698
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    San Clemente, Ca
    if i recall correctly yes, if the account already exists it will through a error that the account exists but it will continue to restore the data.
     
  5. bamasbest

    bamasbest Well-Known Member

    Joined:
    Jan 10, 2004
    Messages:
    531
    Likes Received:
    0
    Trophy Points:
    16
    Why not use rsync?

    After the first grab/backup, all subsequent backups will only grab files that have changed, saving lots of bandwidth;)
     
  6. bleachga

    bleachga Member

    Joined:
    Nov 14, 2003
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    rsync would be easy, but I'd have to know where everything is -- pop mailboxes, forwarders, web folder permissions, etc. I'm not sure everything is under the home directory, is it?

    I'm assuming cpanel knows where to find everything it needs to replicate . . .
     
  7. shaun

    shaun Well-Known Member

    Joined:
    Nov 9, 2001
    Messages:
    698
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    San Clemente, Ca
    just about everything is in /home thats important (web, mail). mysql is in /var/lib/mysql and if you want the valiases/vfilters you'll have to grab those from /etc/valiases/ and /etc/vfilters/ Also mailman is stored in somthing like /usr/local/cpanel/3rdparty/mailman/somthing... have to look it up.

    if you want to know everything you need to grab take a look at /scripts/pkgacct and see what it's grabbing.
     
Loading...

Share This Page