![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| file transfer from https to a Unix box | jvjaimes | UNIX for Dummies Questions & Answers | 4 | 07-21-2008 06:54 PM |
| to transfer a file from unix to window | Nirmal | Shell Programming and Scripting | 3 | 03-19-2008 04:10 AM |
| Transfer FILE from UNIX to WIN2000/XP | ZINGARO | Shell Programming and Scripting | 2 | 08-11-2006 07:38 PM |
| unix automatic file transfer | tagem | UNIX for Advanced & Expert Users | 4 | 11-14-2005 08:50 AM |
| File transfer from unix to NT box? | jvacc | IP Networking | 10 | 06-28-2001 05:44 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
UNIX - SCP File Transfer
Hi,
How do i know if the files are transferred succesfully when i use SCP to transfer files between 2 servers. One more is i am trying to send all the files in a single shot by using * to save the connection time. So can i know when the scp breakes in the middle scp $sourcepath/* user@\$destserver:\$destpath |
|
||||
|
what do you have so far?
Do you have anything so far other than that line? You can test for scp's successful completion by looking to see if the exit status is 0 once it finishes. Here's an example: Code:
#!/bin/bash echo starting transfer scp $sourcepath/* user@\$destserver:\$destpath >> /tmp/log.$$ OUT=$? if [ $OUT = 0 ] ;then echo transfer successful else echo oh no, ftp transfer failed somehow. check log file in tmp for details fi Are your scp transfers typically failing? How large are the files you are transferring? You could also have the script check for files before it transfers, parse the log to see if it needs to retry, email the log files elsewhere, etc. |
|
||||
|
Please don't perpetrate this silly "test $?" idiom. if already by design examines $? Code:
if scp $sourcepath/* user@\$destserver:\$destpath >>/tmp/log.$$ then echo oh yes >&2 else echo "oh no ($?)" >&2 tail /tmp/log.$$ >&2 fi What's with the backslashes in \$destserver:\$destpath? Nothing bash-specific here, by the way, so might as well use good ol' /bin/sh (it's good for you). |
|
||||
|
Thanks and one more doubt
Thanks a lot for era and tderscheid.
I used back slashes to nullify. can i delete each file when the copy is done? If i use SCP by looping i know it can be done but it takes lot of time if i have more files. If i use the * to transfer multiple files it goes in quickly as it dont have to connect every time to the server. |
|
||||
|
I'm missing some of the bigger-picture elements
Quote:
How much time are you losing during the connection process? Aren't you ultimately going to automate this and just drink coffee while the move script runs from crontab and then sends you an email of the log when it's done? Is the time you lose actually a critical factor? If you're having to move, daily, a million tiny files from server A to server B, something else is wrong with that picture. Would server B accept a tar.gz of each group of files you want to send? I am sure Era can find several other angles to improve this. A little more information about the timeline of file creation might be useful. |
|
||||
|
Thanks
Thank you for the help...
I may be moving around 5000 files and i cannot tar them... i need to send individually... I am benefiting around 3 hrs if i send then at a time using the * and if i send then individually its taking that 3-4 hrs more for the 5000 files. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|