Sponsored Content
Full Discussion: Lftp mirror pattern
Top Forums UNIX for Beginners Questions & Answers Lftp mirror pattern Post 303045275 by nezabudka on Sunday 15th of March 2020 06:59:40 AM
Old 03-15-2020
All I can advise
Code:
#!/bin/bash
DATE=`date +%Y%m%d -d "1 days ago"`

USER='user'
PASS='pass'

HOST='192.168.1.1'
LOCAL_BACKUP_DIR='/app/'${DATE}''
REMOTE_DIR='/app/log'
tmp=($(lftp -e "cd $REMOTE_DIR && glob -d echo [0-9]*; quit" -u $USER,$PASS $HOST))
REMOTE_DIR="$REMOTE_DIR/${tmp[@]: -1}"

mkdir -p '/app/'${DATE}''

lftp -u $USER,$PASS $HOST <<EOF
set ftp:ssl-protect-data true
set ftp:ssl-force true
set ssl:verify-certificate no
cd $REMOTE_DIR
lcd $LOCAL_BACKUP_DIR

mirror

quit
EOF

 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

LFTP Mirroring

LFTP Mirroring We are planning to use lftp to mirror some of the files and directories on to the remote server. What we exactly want to do is mirror some of the directories and exclude some of the the directories from "/" i.e. main root. . What lftp is doing is... (0 Replies)
Discussion started by: sameerarora
0 Replies

2. Solaris

ZFS Mirror versus Hardware Mirror

I've looked a little but haven't found a solid answer, assuming there is one. What's better, hardware mirroring or ZFS mirroring? Common practice for us was to use the raid controllers on the Sun x86 servers. Now we've been using ZFS mirroring since U6. Any performance difference? Any other... (3 Replies)
Discussion started by: Lespaul20
3 Replies

3. Solaris

What is mirror and sub mirror in RAID -1 SVM

Hi , I am new to SVM .when i try to learn RAID 1 , first they are creating two RAID 0 strips through metainit d51 1 1 c0t0d0s2 metainit d52 1 1 c1t0d0s2 In the next step metainit d50 -m d51 d50: Mirror is setup next step is metaattach d50 d52 d50 : submirror d52 is... (7 Replies)
Discussion started by: vr_mari
7 Replies

4. UNIX for Advanced & Expert Users

lftp: Option to lftp a file, wait and download a file as soon as its created

Please let me know what is lftp options combination to wait and download a file from target as soon as its gets created. I tried with different options but not able to get it working as I need any help would be appreciated (4 Replies)
Discussion started by: bmkux
4 Replies

5. HP-UX

What is the difference between DRD and Root Mirror Disk using LVM mirror ?

what is the difference between DRD and Root Mirror Disk using LVM mirror ? (3 Replies)
Discussion started by: maxim42
3 Replies

6. Red Hat

Lftp issue

I installed KVM and configured two virtual machines in it server1.example.com(192.168.100.193) and tester1.example.com(192.168.100.230).I want to access server1.example.com from tester1.example.com over lftp.As far as networking is concerned between both I do have some doubts. I tried ping and... (5 Replies)
Discussion started by: shazgaurav
5 Replies

7. UNIX for Dummies Questions & Answers

Lftp operation

dear all, I need to get files from ftp when only files consist of words 'EUROPE' ftp sources in folder /ftp1/ftp2/ftp3/201409 files inside /ftp1/ftp2/ftp3/201409is as below 201409_EUROPE_citizen.txt 201409_EUROPE_natality.txt 201409_EUROPE_occupancy.txt 201409_ASIA_citizen.txt... (1 Reply)
Discussion started by: radius
1 Replies

8. Shell Programming and Scripting

lftp is not working.how to replace lftp with expect utility using same .cfg file.

We have lftp command inside shell file. which is intern calling .cfg file for transferring the file from one server to other. Below command to not working. lftp -e "set net:max-retries 1; set net:reconnect-interval-base 1; put -E -O /destinationdir/inbox/ /sourcedir/test.txt; bye" -u... (4 Replies)
Discussion started by: johnsnow
4 Replies

9. Shell Programming and Scripting

Error with LFTP

I use below ftp command to push the file from UNIX server to Mainframe system. (lftp -d -e "set ftp:passive-mode false; put -a ${SPOOLFILE} -o ${FNAME}; exit" -u ${id},${paswd} ${host} ) >> $ftplog To ftp the file successfully i need to get the out put for FNAME as "'filename'" (double... (5 Replies)
Discussion started by: zooby
5 Replies
Net::POP3(3pm)						 Perl Programmers Reference Guide					    Net::POP3(3pm)

NAME
Net::POP3 - Post Office Protocol 3 Client class (RFC1939) SYNOPSIS
use Net::POP3; # Constructors $pop = Net::POP3->new('pop3host'); $pop = Net::POP3->new('pop3host', Timeout => 60); if ($pop->login($username, $password) > 0) { my $msgnums = $pop->list; # hashref of msgnum => size foreach my $msgnum (keys %$msgnums) { my $msg = $pop->get($msgnum); print @$msg; $pop->delete($msgnum); } } $pop->quit; DESCRIPTION
This module implements a client interface to the POP3 protocol, enabling a perl5 application to talk to POP3 servers. This documentation assumes that you are familiar with the POP3 protocol described in RFC1939. A new Net::POP3 object must be created with the new method. Once this has been done, all POP3 commands are accessed via method calls on the object. CONSTRUCTOR
new ( [ HOST ] [, OPTIONS ] 0 This is the constructor for a new Net::POP3 object. "HOST" is the name of the remote host to which an POP3 connection is required. "HOST" is optional. If "HOST" is not given then it may instead be passed as the "Host" option described below. If neither is given then the "POP3_Hosts" specified in "Net::Config" will be used. "OPTIONS" are passed in a hash like fashion, using key and value pairs. Possible options are: Host - POP3 host to connect to. It may be a single scalar, as defined for the "PeerAddr" option in IO::Socket::INET, or a reference to an array with hosts to try in turn. The "host" method will return the value which was used to connect to the host. ResvPort - If given then the socket for the "Net::POP3" object will be bound to the local port given using "bind" when the socket is created. Timeout - Maximum time, in seconds, to wait for a response from the POP3 server (default: 120) Debug - Enable debugging information METHODS
Unless otherwise stated all methods return either a true or false value, with true meaning that the operation was a success. When a method states that it returns a value, failure will be returned as undef or an empty list. auth ( USERNAME, PASSWORD ) Attempt SASL authentication. user ( USER ) Send the USER command. pass ( PASS ) Send the PASS command. Returns the number of messages in the mailbox. login ( [ USER [, PASS ]] ) Send both the USER and PASS commands. If "PASS" is not given the "Net::POP3" uses "Net::Netrc" to lookup the password using the host and username. If the username is not specified then the current user name will be used. Returns the number of messages in the mailbox. However if there are no messages on the server the string "0E0" will be returned. This is will give a true value in a boolean context, but zero in a numeric context. If there was an error authenticating the user then undef will be returned. apop ( [ USER [, PASS ]] ) Authenticate with the server identifying as "USER" with password "PASS". Similar to "login", but the password is not sent in clear text. To use this method you must have the Digest::MD5 or the MD5 module installed, otherwise this method will return undef. banner () Return the sever's connection banner capa () Return a reference to a hash of the capabilities of the server. APOP is added as a pseudo capability. Note that I've been unable to find a list of the standard capability values, and some appear to be multi-word and some are not. We make an attempt at intelligently parsing them, but it may not be correct. capabilities () Just like capa, but only uses a cache from the last time we asked the server, so as to avoid asking more than once. top ( MSGNUM [, NUMLINES ] ) Get the header and the first "NUMLINES" of the body for the message "MSGNUM". Returns a reference to an array which contains the lines of text read from the server. list ( [ MSGNUM ] ) If called with an argument the "list" returns the size of the message in octets. If called without arguments a reference to a hash is returned. The keys will be the "MSGNUM"'s of all undeleted messages and the values will be their size in octets. get ( MSGNUM [, FH ] ) Get the message "MSGNUM" from the remote mailbox. If "FH" is not given then get returns a reference to an array which contains the lines of text read from the server. If "FH" is given then the lines returned from the server are printed to the filehandle "FH". getfh ( MSGNUM ) As per get(), but returns a tied filehandle. Reading from this filehandle returns the requested message. The filehandle will return EOF at the end of the message and should not be reused. last () Returns the highest "MSGNUM" of all the messages accessed. popstat () Returns a list of two elements. These are the number of undeleted elements and the size of the mbox in octets. ping ( USER ) Returns a list of two elements. These are the number of new messages and the total number of messages for "USER". uidl ( [ MSGNUM ] ) Returns a unique identifier for "MSGNUM" if given. If "MSGNUM" is not given "uidl" returns a reference to a hash where the keys are the message numbers and the values are the unique identifiers. delete ( MSGNUM ) Mark message "MSGNUM" to be deleted from the remote mailbox. All messages that are marked to be deleted will be removed from the remote mailbox when the server connection closed. reset () Reset the status of the remote POP3 server. This includes resetting the status of all messages to not be deleted. quit () Quit and close the connection to the remote POP3 server. Any messages marked as deleted will be deleted from the remote mailbox. NOTES
If a "Net::POP3" object goes out of scope before "quit" method is called then the "reset" method will called before the connection is closed. This means that any messages marked to be deleted will not be. SEE ALSO
Net::Netrc, Net::Cmd AUTHOR
Graham Barr <gbarr@pobox.com> COPYRIGHT
Copyright (c) 1995-2003 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.18.2 2014-01-06 Net::POP3(3pm)
All times are GMT -4. The time now is 09:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy