Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Member
    Join Date
    Nov 2006
    Posts
    14

    Default Whats best way to Backup all CPanel accounts and databases to my PC

    Hi

    Before I start, my home PC is Windows XP...

    I want to backup all my CPanel accounts and databases to my home PC (in addition to my hosting provider making backups).

    Now I can see various software out there. I tried Site Backup CP and it looks good. BUT the software, and Cpanel iteslf, seem to make FULL backups. This will have a very bad impact on my bandwidth limits as I want to do it every day.

    So I am looking into rsync. I got rsync working to backup the files, and it will only backup CHANGED files, and delete files deleted from the server, so making a complete mirror. Great! Except I can't see how to do this for the MySQL databases and anything else I need to do (emails, aliases, parked/addon domains etc.).

    So does anyone know a good solution I can use to backup all my changed files PLUS my databases and any other important CPenal data to my home PC without having to do a FULL backup every time. I am using Windows XP so this may exclude any bash scripts I can see that are available.

    Thanks

    Laurie

  2. #2
    Member
    Join Date
    May 2006
    Location
    Johannesburg, South Africa
    Posts
    881

    Default

    If you have managed to get rsync to work, congrats

    It's an awesome tool.

    Here's the idea:

    Use mysqldump, from the commandline, via a crontab to dump the DB, preferabbly in your root folder so that it can't be downloaded. Then, after that command has run, in the same script run rsync to sync your website, and the dumbed DB to your PC. This way you could automate the whole process.

    The otherway, is to setup MySQL on your home PC, and look @ doing a master - slave replication, where the MySQL on your website will be the master, and the one on your PC will be the slave. The MySQL on your PC will then automatically keep all DB transactions in sync.

    hth
    • cPanel :: Fantastico :: RVSkin :: WHM :: ModernBill
    • Reseller Hosting :: SSL Certificates :: Domain Registrations :: Affiliate Program
    • Blog Hosting :: CMS Hosting :: Forum Hosting :: E-Commerce Hosting
    SoftDux- The Leaders in Software
    Use the coupon: cpanel-06 to get 20% off our packages

  3. #3
    Member
    Join Date
    Nov 2006
    Posts
    14

    Default

    Thanks for replying. I just came back here to post my current solution which is quite similar... yes rsync is great (although difficult to get working) as it only does a backup of changed files! Seeing as there's so many image files in shopping carts and such it would be really bad for full backups every day.

    If anyone knows how to backup the email accounts, aliases and anything else I need to do to backup Cpanel in addition to this I would be grateful.

    So here's my current solution, using SSH and rsync.

    I use a .cmd file on Windows PC with Windows based command scripts. This way I can then schedule in the file to run. So I called my file "backup.cmd". Or you can call it a .bat file.

    The scripts I use basically first use SSH to run mysql dump to dump the database file, then use rsync to synchronise the files with the files on my PC.

    So I installed SSH and rsync on my Windows PC, and then setup private and public keys so I dont need a password. Instructions for all this here: http://optics.ph.unimelb.edu.au/help...rsync_pc1.html

    Then once rsync and ssh is installed on your PC you can run the file. After playing around with it for a while I got the following command lines working and placed them in the .cmd or .bat file:-


    Code:
    ssh -i private_key_file %CPANEL_USERNAME%@your_domain.com "mysqldump -u %CPANEL_DATABASE_USERNAME% --password="%CPANEL_DATABASE_PASSWORD%" %CPANEL_DATABASE% > %CPANEL_DATABASE%.sql"
    
    rsync -avzp --stats --delete-before --force -e "ssh -i private_key_file" %CPANEL_USERNAME%@your_domain.com:/home/%CPANEL_USERNAME%/ /cygdrive/f/%CLIENT_DOMAIN_NAME%/
    The text enclosed in % % are variables that can be set with SET %CPANEL_USERNAME%=cpanel_username or just insert your values here direct.

    Be really careful with rsync though. Especially when using --delete commands, you may delete files on the server or your PC with incorrect use. So play around with a test account first.

  4. #4
    Member
    Join Date
    May 2006
    Location
    Johannesburg, South Africa
    Posts
    881

    Default

    Your email is also stored in your account, under a folder called /email
    • cPanel :: Fantastico :: RVSkin :: WHM :: ModernBill
    • Reseller Hosting :: SSL Certificates :: Domain Registrations :: Affiliate Program
    • Blog Hosting :: CMS Hosting :: Forum Hosting :: E-Commerce Hosting
    SoftDux- The Leaders in Software
    Use the coupon: cpanel-06 to get 20% off our packages

Similar Threads & Tags
Similar threads

  1. Shared MySQL databases and php files for several CPanel accounts
    By mikityuk in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 09-13-2007, 01:28 PM
  2. cpanel accounts cant add database users to databases
    By doubleg in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 06-07-2007, 10:37 AM
  3. Whats the best way to backup?
    By talon39 in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 03-01-2004, 06:42 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube