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

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Status of a remote file using SCP?

Reply to Message Icon

Name: rajus19
Date: April 27, 2006 at 01:05:05 Pacific
OS: Unix
CPU/Ram: P4 256 MB
Product: 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



Sponsored Link
Ads by Google

Response Number 1
Name: lchi2000g
Date: April 27, 2006 at 06:35:11 Pacific
Reply:

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


0
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Status of a remote file using SCP?

Start & End time of a log file www.computing.net/answers/unix/start-amp-end-time-of-a-log-file/6935.html

update the contents of a file in Un www.computing.net/answers/unix/update-the-contents-of-a-file-in-un/5963.html

Split a Text file using blank line www.computing.net/answers/unix/split-a-text-file-using-blank-line/7501.html