automate pull linux backup file to window server

Scenario:

Guys, there are always a very good question on “where are the backup file store?”. In the IT field, we know that it is not SAFE to store backup file inside the same disk storage.
Recently, I has a customer would like to pull their application backup file from a Window server.
Here is the solution after I done some research on it.


Solution:

Manual Execution:

  • Download the PSCP.exe from Putty download page (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html)
  • Open a Command Prompt and execute following command
  • pscp.exe -pw <SHELL PASSWORD> <SHELL USER>@<HOST>:<FILE PATH> <DESTINATION>

    Command example:

    pscp.exe -pw password1 root@192.168.10.111:/var/www/html/abc.log "C:\."

    Result:
    abc.log will be transfer to C:\ drive. (Do remember to add in the “.” behind the “C:\”. It is a MUST!)

    Now, let us combine all put it into a bat file to allow window scheduler can execute it base on the scheduled time.

  • Put the PSCP.exe into “C:\backup\”
  • Open a notepad and put following content into it, save it as “backup.bat” under “C:\backup\” (Remember to change all the user information)
  • pscp.exe -pw password1 root@192.168.10.111:/var/www/html/abc.log "C:\backup\."
  • Double click the “backup.bat” and check your result
  • If successful, using the Window schedule task function to execute the “backup.bat”
  • Leave a Reply