FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Red Hat Linux

 
 
LinkBack Thread Tools
 
Old 12-10-2010, 12:52 PM
a bv
 
Default ftp problem on bash script

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

--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
 
Old 12-10-2010, 03:39 PM
Nigel Wade
 
Default ftp problem on bash script

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.

--
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555

--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
 
Old 12-10-2010, 09:07 PM
urgrue
 
Default ftp problem on bash script

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@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
 
Old 12-13-2010, 07:31 AM
a bv
 
Default ftp problem on bash script

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@bulbous.org>:
> 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@redhat.com?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list
>

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

Thread Tools




All times are GMT. The time now is 09:31 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org