1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

How to automate backup retreival to your Local computer

Discussion in 'Tips and Guides [Archive]' started by Blandt, Nov 21, 2010.

  1. Blandt

    Blandt Well-Known Member

    Ok SouthernLady Asked for a how to Automate the download of your backup from your Linux remote server to your Local windows computer.
    This is done in 2 steps :
    1. Automate your backup at the server so will have one zipped file for your backup (done via Cpanel ... or I can post the script if you need it)

    2. automatic download of the backup file to your local computer: Here is a step by step tutorial better than anything I could manage to write :D

    http://wiki.vpslink.com/Automate_Backup_Retrieval_with_WinSCP

    Let me know if you need further help
     
    Brandon Sheley, Elizabeth and Floris like this.
  2. steven s

    steven s Well-Known Member

    The backup file (on your website) needs to have the same name so it writes over the previous backup.
    Otherwise diskspace fills up quickly.
     
  3. Elizabeth

    Elizabeth Well-Known Member

    What about the one using the Task Manager?
     
  4. Blandt

    Blandt Well-Known Member

    It's all there :)
    Task Scheduler is used to fire up WinSCP just like a cron Job for a linux box.

    Are you lost ? ... I can stitch up another tutorial if the link posted is not easy to understand ... or you can ask us here :)
     
  5. Elizabeth

    Elizabeth Well-Known Member

    I'll have to test it...right now is not the best time as my ISP decided to be a pill today (using the wireless card on my laptop). Thankfully, I use WinSCP as my primary SFTP so I am familiar with it.

    Thanks, Blandt.
     
  6. Blandt

    Blandt Well-Known Member

    WinSCP can be scripted (automated) to do common tasks ... then Task Scheduler is used to fire it up automatically.
    If you need help setting it up .. let me know :)
     
  7. Elizabeth

    Elizabeth Well-Known Member

    Now that I didn't know. And I probably will. :)
     
  8. Floris

    Floris Guest

    Nice of you to write it out Blandt :)
     
  9. Blandt

    Blandt Well-Known Member

    Have your Desktop computer login to your server and retrieve your backup files while you sleep :)
    The ides is to use WinSCP to do this for us:
    First we need to create a windows user with limited privileges on a Windows 7 :
    Go to Control Panel, Click "add or Remove User Accounts", Then "Create a new Account" and select "Standard User", name it Backup (or anything else)
    once that's done create a password for this new user : Click on it then "create a new password"
    3. Click Start ---> under "shut down" click switch user and logon to your newly created backup user : This will automatically create a backup folder C:\Users\backup : and this is where we are going to store our (daily | weekly | monthly) backups
    Now click Start --- > switch accounts again and logon under the main Administrator account … Click
    computer ---> Local Disk C: ---> users ----> backup , Grant yourself to permanently access this folder. We are done with this Step. Next we are goint to download and install WinSCP:
    http://winscp.net/eng/download.php#download2 Dowanload the latest installer
    The next step involves writing a small script for WinSCP like so :
    Open NotePad and copy paste this Script and replace the relevant bits with your own informations :
    HTML:
    option batch on
    option confirm off
    # Here goes your sever ftp login information  The formatis  user:assword@host
    open YOUR_BACKUP_USERNAME:YOUR_BACKUP_PASSWORD@YOUR_IP_ADDRESS
    # This is the path where your backup zipped file is stored on your remote server. It must be under /home/your_user_name/ directory
    cd /home/your_user_name
    # Force binary mode transfer
    option transfer binary
    # Download backup file (this is your compressed public directory backup) to the local directory
    get backup.gz C:\Users\backup\
    # Download backup MySQL (This is your compressed Mysql Dump file) to the local directory
    get Mysql.sql.gz c:\users\backups\
    # Disconnect
    close
    # Exit WinSCP
    exit
    
    Save this file and name it automate.txt under c:\users\backup
    switch users again to backup : click start ---> switch users and select the backup user
    Once logged in click start, type in CMD in that little search box : you will get a command prompt window
    Type in the command line : C:\Program Files\WinSCP\winscp.exe" /console /script=c:\users\backup\automate.txt
    Click Yes to accept the key
    The next step is to tell Windows to wake up daily | weekly | monthly | to run the script we just created to download our backup files
    Go to the Start button
    Select Settings > Control Panel
    Select Scheduled Tasks to open the Scheduled Task Wizard
    Select Add Scheduled Task and click Next
    Locate and select WinSCP on the program list and click Next
    Enter a name for the task (anything really but name it something that makes sense to you), select the task frequency ( this should be set based on the frequency your server cron job is backing up your data), click Next
    Enter and confirm your Windows user account password for the task's RunAs credentials (This is the backup user/password we created above) and click Next
    Check the Open advanced properties for this task when I click Finish box
    Click Finish to exit the Scheduled Task Wizard and open the task's properties dialog
    Add /console /script=c:\users\backup\automate.txt
    Click Finish to exit the Scheduled Task Wizard and open the task's properties dialog
    Click Apply and confirm your Windows user account password if prompted
    Click OK to exit the task's properties dialog
    From the Scheduled Tasks window, right-click on your WinSCP backup task and select Run to test the new task
    That's it we're done :)
    Make sure your server is taking backups daily for WinSCP to logon and grab those files for you
     
  10. Blandt

    Blandt Well-Known Member

    OOh Sorry this looks ugly :D but I did my best having the uber newbie in mind. Screen shots will be easier ... I will do it when I have time .. or maybe Floris can do it !
     
  11. steven s

    steven s Well-Known Member

    I've been backing up my website through cPanel and the program, backup smart.
    My tar.gz backup is 6.2G. Despite two different compression programs, the file is always corrupt when expanding.
    Are there limits in cPanel?
    My smaller sites backup with no problem.

    Edit: I just found that there is a 4G limit on backups. :(
    Edit again: Maybe not. I can make backups, they are just corrupt.
     
  12. Blandt

    Blandt Well-Known Member

    If your site is that big .. you need to use command line to backup ... a script will do the trick. php apps have limitations

    I heard about big dump, and it seems that people are really happy with it, although I never used it, check it out :

    http://www.ozerov.de/bigdump.php
     
  13. steven s

    steven s Well-Known Member

    I'm going to break my forum into subdomains. .forum, .gallery. That should help with backups.
    Big dump is useful for restoring databases, not files. I use it all the time.
    Peggy's mishap is a wakeup call.
     

Share This Page