The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Special Forums > IP Networking
.
google unix.com



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 11:52 AM
process vs task hana UNIX for Dummies Questions & Answers 2 07-02-2006 06:32 PM
Automated FTP shauche UNIX for Advanced & Expert Users 11 07-11-2002 02:08 AM
FTP automated? n9ninchd UNIX for Dummies Questions & Answers 6 05-18-2001 10:21 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #29 (permalink)  
Old 11-30-2006
Tornado's Avatar
Tornado Tornado is offline Forum Advisor  
Registered User
  
 

Join Date: Nov 2006
Location: Melbourne
Posts: 249
Quote:
Originally Posted by sysgate
I haven't read the entire thread, but when it comes to automated FTP transfers ( every day to backup machine ) use rsync.
In my case rsync is blocked by 2 firewalls, But even if it wasn't blocked the customer doesn't want to install any additional software and wants to use their ftp server.
  #30 (permalink)  
Old 11-30-2006
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
Quote:
Originally Posted by Tornado
Anyone have any ideas how I can remove files older then 28 days from the remote servers .sent directory($ROUT/.sent) ?
You will need to get a directory listing of the remote directory and parse it to extract the name and date. See this thread to see a script that does this sort of thing.
  #31 (permalink)  
Old 12-01-2006
Tornado's Avatar
Tornado Tornado is offline Forum Advisor  
Registered User
  
 

Join Date: Nov 2006
Location: Melbourne
Posts: 249
I managed to get it working by adding this function.
Code:
cleanup ()
{
    echo "=======================================" >> $LOG2
    echo "==    Cleaning up old sent files     ==" >> $LOG2
    echo "=======================================" >> $LOG2
    echo " Files removed from $LHOST:$LOUT/.sent" >> $LOG2

    ## Clean up local servers Outgoing folder
    cd $LOUT/.sent
    find $LOUT/.sent -mtime +14 >> $LOG2
    find $LOUT/.sent -mtime +14 -exec rm {} \;

    ## Create the .history folder
    cat /dev/null > $LIN/.history/.list
    cd $LIN
    for history in `ls` ; do
        touch $LIN/.history/$history
    done

    exec 4>&1
    ftp -n >&4 2>&1 |&

    pid5=$!
    print -p open $RHOST
    print -p user $USER $PASSWD
    print -p binary
    print -p cd $ROUT/.sent
    cd $LIN/.history
    find $LIN/.history -mtime +14 >> $LIN/.history/.list
    for old in `cat $LIN/.history/.list` ; do
        print -p delete $old    # Delete file from remote server
        rm $old                 # Delete file from local folder
    done
    print -p bye
    wait $pid5

    echo " Files removed from $RHOST:$ROUT/.sent" >> $LOG2
    cat $LIN/.history/.list >> $LOG2
    echo "" >> $LOG2
}

Last edited by Tornado; 10-08-2007 at 06:07 PM..
  #32 (permalink)  
Old 12-01-2006
Tornado's Avatar
Tornado Tornado is offline Forum Advisor  
Registered User
  
 

Join Date: Nov 2006
Location: Melbourne
Posts: 249
I've updated the script I posted above to include the cleanup function..
  #33 (permalink)  
Old 02-20-2007
sujitmenon sujitmenon is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 1
Arrow ftp in cygwin

Hi,

I tried the ftp program in cygwin and was not able to execute it. It shows error
--------------------------------------------
nortel_admin@TCS036694 /usr/local/bin
$ ksh ftpsh
ftpsh: 9: Syntax error: "&" unexpected

nortel_admin@TCS036694 /usr/local/bin
$
--------------------------------------------
basically it refers to line


*************************
exec 4>&1
ftp -nv >&4 2>&4 | &
*************************

Please advice...

Regards,
Sujit Menon
  #34 (permalink)  
Old 10-19-2007
rakeshou rakeshou is offline
Registered User
  
 

Join Date: May 2007
Posts: 75
Smile Hard to understand

Quote:
exec 4>&1
ftp -nv >&4 2>&4 | &
didn't get what it does.

please explain.

thanks

Last edited by rakeshou; 10-19-2007 at 11:14 AM..
  #35 (permalink)  
Old 10-20-2007
Tornado's Avatar
Tornado Tornado is offline Forum Advisor  
Registered User
  
 

Join Date: Nov 2006
Location: Melbourne
Posts: 249
Quote:
Originally Posted by sujitmenon View Post
Hi,

I tried the ftp program in cygwin and was not able to execute it. It shows error
--------------------------------------------
nortel_admin@TCS036694 /usr/local/bin
$ ksh ftpsh
ftpsh: 9: Syntax error: "&" unexpected

nortel_admin@TCS036694 /usr/local/bin
$
--------------------------------------------
basically it refers to line


*************************
exec 4>&1
ftp -nv >&4 2>&4 | &
*************************

Please advice...

Regards,
Sujit Menon
Before you run the script try changing to a ksh shell, instead of:
$ ksh ftpsh
try
$ exec ksh
$ ftpsh
Sponsored Links
Closed Thread

Bookmarks

Tags
linux, mtime, sendmail

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:43 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0