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:
View Code PHP
pscp.exe -pw <SHELL PASSWORD> <SHELL USER>@<HOST>:<FILE PATH> <DESTINATION> |
Command example:
View Code PHP
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.
View Code PHP
pscp.exe -pw password1 root@192.168.10.111:/var/www/html/abc.log "C:\backup\." |