![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Shell Script question | ryanique | Shell Programming and Scripting | 10 | 08-26-2008 02:08 PM |
| Linux Shell Question: how to print the shell script name ? | meili100 | UNIX for Dummies Questions & Answers | 3 | 07-01-2008 01:55 PM |
| Shell script question | jbou1087 | Shell Programming and Scripting | 2 | 05-06-2008 02:01 AM |
| shell script question | tselvanin | Shell Programming and Scripting | 2 | 08-28-2007 09:53 PM |
| A shell script question | surjyap | Shell Programming and Scripting | 2 | 11-24-2005 05:48 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
FTP - shell script question
Hi All,
I had a question on something which i have trying to add to my current shell script which does FTP of files from my local machine to a remote server. I have 5 files which i zip and FTP them on daily basis to a remote server. My script is as below: ############################ #!/bin/sh temp="put $1" ftp xxxx.this is IP address of remote machine.com << EOFFile myusername binary $temp quit EOFFile exit 0 ############################ I am successfull in doing this activity. But sometimes there is some problem with the remote FTP machine the FTP fails. My problem is that i am only able to determine this failure after manually logging in checking for the files on remote machine. My remote files look like this on FTP machine, all the files have the same name each day and The system date of this matches with the local machine: 08-31-08 10:00PM 55182 help1.zip 08-31-08 10:00PM 64861 help2.zip 08-31-08 10:00PM 57915 help3.zip 08-31-08 10:01PM 224245 help4.zip 08-31-08 10:01PM 2388 help5.zip Is there a way i can add in my script or have an external script that checks for these files on FTP machine( probablly compare with local machine date stamp and FTP date stamp to determine the latest files are there). Please suggest Thanks, Sandy |
|
||||
|
One option shoud be ..
After copying files to remote server, just before quit the connection, give a ls and capture it in a shell variable.Then, verify the files list from the variable... ie, Code:
var=$(ftp xxxx.this is IP address of remote machine.com << EOFFile ...... ... lcd ls quit EOFfile ) echo $var |
|
||||
|
Hi dennis,
#!/bin/sh var=$(ftp www.state.il.us << EOFFile symphems binary ls quit EOFfile ) This gives me the required results but the results of echo $var is as below: 11:52PM 61954 help1.zip 09-02-08 10:01PM 8153 help2.zip 09-02-08 10:01PM 1890 help3.zip The results are in a single line. Can you please help how i can have them one fter another. Thanks, Sandy |
|
||||
|
Quote:
Assuming that you have only zip files in the location: Code:
echo $var | sed 's/zip/zip\n/g' Code:
echo $var | xargs -n4 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|