Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi All,
Thanks in Advance.
My requirement is there are some data files to be updated(some times new files get created) regularly in server A, these files are to be updated to the server B(backup server) by using SCP, I have to write a script for this purpose, before copying the files to server B, the current files in server B to be taken backup in backup floder of server B.
The problem is if the data file is new in server A it will just be copied to server B, if the data file is existing one and has updated in server A the script has to take the backup of existing file in server B & then copy the updated file from server A to server B.
After connecting to the server B using SCP how can I check whether the file is there or not (any conditional checks), then only it will be decided whether to only copy the file or taking the backup and then copy.
Your help will be greatly appreciated.
Thanks,
Raju
Thanks and Regards
Raju

In your script on A server(bk.sh):
1. DYNAMICALLY create a scrip(archive.sh) which archives the will-be-overwritten existing files on the B server
2. scp archive.sh to B server
3. ssh (remote execute) archive.sh on the B server
4. scp the target backup files from A server to B server
Luke Chi

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |