Re: ftp problem on bash script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks for all but im also mainly having a problem releated to showing
the the archived file (which is created at the archiving part of the
script)  as an input to the ftp part of the script.

Regards

2010/12/11 urgrue <urgrue@xxxxxxxxxxx>:
> On 10/12/2010 17:39, Nigel Wade wrote:
>>
>> On 10/12/10 13:52, a bv wrote:
>>>
>>> Hi Im trying to write a bash script which will run on Checkpoint
>>> Secureplatform (which is
>>> Redhat indeed) seems below. First part of the script will make an
>>> yesterdays log archive ,
>>> other part will  copy this archive to an ftp server. The archive
>>> creation process works fine when ftp part is commented or deleted, but
>>> doesnt work. As one script or another script for ftp, how can i work
>>> this to create the archive and and copy it to the ftp site.
>>>
>>> Regards
>>>
>>>
>>> # !/bin/sh
>>>
>>> # Define string variables!
>>> hostname="intsrvb.abank.com.tr"
>>> ftp_server="myserver"
>>> ftp_username="myuser"
>>> ftp_password="mypassword"
>>> cpdir=/opt/CPshrd-R70
>>> localbakdir=/opt/CPsuite-R70/fw1/log/
>>> remotebakdir=/tape/2010tape/log/omega/cp/
>>> logdate=`/bin/date --date="yesterday" +%Y-%m-%d`
>>> logname=${logdate}
>>> archivedate=`/bin/date --date="yesterday" +%Y_%m_%d`
>>> archivename=logs_${hostname}_${archivedate}
>>>
>>> # Set Check Point profile for library settings!
>>> . $cpdir/tmp/.CPprofile.sh
>>>
>>>
>>> # Archive yesterday`s log files!
>>> cd ${localbakdir}
>>> /bin/tar zcf ${localbakdir}${archivename}.tgz ${logname}*
>>>
>>> # FTP files to backup server!
>>> #ftp -in $ftp_server<<EOC
>>> #user  myuser mypassword
>>> #binary
>>> #cd ${remotebakdir}
>>> #lcd ${localbakdir}
>>> #put ${archivename}.tgz
>>> #bye
>>>
>>
>> FTP won't read passwords from a redirected input script.
>>
>> You need to create .netrc file, or maybe expect will work but it's so
>> long since I worked with automated FTP that I can't remember.
>>
>
> Imho the easiest solution is to use lftp. All this is easily scripted. E.g.:
> open -u username,password ftp.site.com
> cd /blah/blah
> lcd /blah/blah
> get this
> put that
> bye
>
> save that in a file and then just lftp -f <file>
>
> --
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list
>

-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list



[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux