![]() |
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 |
| IP Networking Learn TCP/IP, Internet Protocol, Routing, Routers, Network protocols in this UNIX and Linux forum. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| automated ftp. | sangfroid | Shell Programming and Scripting | 10 | 05-07-2007 12:52 PM |
| process vs task | hana | UNIX for Dummies Questions & Answers | 2 | 07-02-2006 07:32 PM |
| Automated FTP | shauche | UNIX for Advanced & Expert Users | 11 | 07-11-2002 03:08 AM |
| FTP automated? | n9ninchd | UNIX for Dummies Questions & Answers | 6 | 05-18-2001 11:21 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Every day i ftp tar.gz a file from the production server to a back up machine.. This task creates way to much traffic on the network at the end of the day and puts and undo load on the production machine during operation hours. i would like to create a script that would automatically fire off the ftp at like 2:00 am so that the transfer occurs when there is little or no load on the network. if anyone has suggestions on how to accomplish this, PLEASE let me know...
thanks.. --e0 loworderbit@aol.com |
|
||||
|
I'm using your code but i have a problem,
i need the code to be flexible in such a way that it changes the filename it gets everyday. And it should be done automatically. For example, 1st day: get apr20.log 2nd day: get apr21.log Code:
#! /usr/bin/ksh HOST=remote.host.name USER=whoever PASSWD=whatever exec 4>&1 ftp -nv >&4 2>&4 |& print -p open $HOST print -p user $USER $PASSWD print -p cd directory print -p binary print -p get -filename that changes automatically everyday- print -p bye wait exit 0 |
|
|||||
|
hmm... write a script on the server that is launched daily using the cron (man crontab)... have that script ftp to your workstation or wherever and grab the file. The automated FTP will probably require a .netrc file in your user directory or wherever you ftp to to get the file.
However, if you are having to tar the file manually every day, write a script on the workstation side to do that for you a few minutes before the server script executes... once again, utilizing the crontab. Good luck and let me know how it goes. Strange... those other replies both popped up while I was writing... ummm... take their advice. ![]() Last edited by ober5861; 08-29-2001 at 03:40 PM.. |
|
|||||
|
Quote:
The line "ftp -nv >&4 2>&1 |&" is a little harder. The "|&" turns the process into a co-process that allows subsequent "print -p" statements to send lines to the co-process' standard-in and "read -p" to read from its standard-out. So ksh forks a copy of itself and fiddles with the fd's 0 and 1 until this it set-up. But it leaves the rest of the fd's alone. Then it encounters ">&4" which causes it to set the ftp process' standard out to whatever 4 is. Well since 4 is a copy of 1 before the co-process, we are back to writing to the original shell's standard out. Lastly, the 2>&4 does the same thing for standard error. I could've used "2>&1" at this point for the same effect. This is hard to explain, but I hope this helps. |
![]() |
| Bookmarks |
| Tags |
| linux, mtime, sendmail |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|