Computing.Net > Forums > Unix > Status of a remote file using SCP?

Status of a remote file using SCP?

Reply to Message Icon

Original Message
Name: rajus19
Date: April 27, 2006 at 01:05:05 Pacific
Subject: Status of a remote file using SCP?
OS: Unix
CPU/Ram: P4 256 MB
Model/Manufacturer: intel
Comment:

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


Report Offensive Message For Removal

Response Number 1
Name: lchi2000g
Date: April 27, 2006 at 06:35:11 Pacific
Subject: Status of a remote file using SCP?
Reply: (edit)

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


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Status of a remote file using SCP?

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software