- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- how to run FTP through scripts ....
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2002 08:10 PM
07-21-2002 08:10 PM
I've a list of files and their corresponding locations on the host server .... every fortnight on week ends, i need to ftp those files to new locations in my remote client ....
In my network, the client can connect to the Host using ftp/telnet etc., but the host is protected by firewall to see the client ...
cheers
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2002 08:39 PM
07-21-2002 08:39 PM
Re: how to run FTP through scripts ....
set -x
ftp -i -n << !EOF
open 10.196.8.241
user anonymous scott@unix.com
cd /tmp
bin
put today.html
bye
!EOF
the set -x just reports the variables being set etc but it isn't required for real.
you can put any commands you like in here that you can use with ftp.
You could for example go:
prompt
mput *.txt
Hope this helps.
Scott.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2002 08:56 PM
07-21-2002 08:56 PM
Re: how to run FTP through scripts ....
Another example
ftp -nv $dis_machine > /dev/null <
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2002 09:11 PM
07-21-2002 09:11 PM
Re: how to run FTP through scripts ....
You would need to open port 22 to let ftp traffic through. Not a good choice. You should perhaps look at using openssh with 'sftp'. It comes as part of the package. You can download the latest version (source) and compile it from http://openssh.org The current version from the porting centre has been identified as having a security hole.
The scripts that other guys have provided may in fact work with 'sftp'
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2002 09:21 PM
07-21-2002 09:21 PM
Re: how to run FTP through scripts ....
As already mentioned, FTP is cleartext (i.e. data traffic can be sniffed on the network) and requires ftp-control (TCP/21) and ftp-data (TCP/20) to be opened at your firewall.
Apart from sftp as mentioned, you might also want to consider scp (the secured equivalent of rcp) and make use of public key trust relationships to automate file transfers securely. The ssh family provides security features of confidentiality, integrity and non-repudiation.
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2002 11:51 AM
07-22-2002 11:51 AM
SolutionMy shell script which is run from cron has the following command (among other things)
ftp -n -v < cmdstosend > logfile 2>&1
The cmdtosend file has the following ftp commands in it:
open ip.address
user username password
cd "full_path"
pwd (just to echo for my log file)
lcd full_path
binary (or ascii)
put file
close quit
I then e-mail myself the log file for verification.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2002 12:08 PM
07-22-2002 12:08 PM
Re: how to run FTP through scripts ....
I've attached an example script.
It first logs you in to a remote server, change the remote host, user, and password to suit your needs. It then does a cwd to /tmp and puts ftp in 'binary mode'. It then reads the command line for filenames to send. It will try each one up to 5 times. The beauty of doing this in perl is that the error checking is built right in. You will need to download and install the Net::FTP module from http://www.perl.org/CPAN but after that you are done. I never bother trying to do this stuff in the shell anymore because this is so much easier.
P.S. If you need to punch through a proxy server, simply supply a 3rd argument to the login subroutine and it will be just like you typed the account ftp command yourself.
Regards, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2002 01:26 PM
07-22-2002 01:26 PM
Re: how to run FTP through scripts ....
I agree with Clay. He's provided quite a few examples here on the forum and it's the only way I would go.
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2002 01:37 PM
07-22-2002 01:37 PM
Re: how to run FTP through scripts ....
just like the rest I do not recommend "ftp" for this (and if you do use it anyway, please look at the "$HOME/.netrc" feature - "man netrc").
Investigate into tools like "scp" (part of SSH), or my favourite for this task "rsync" (using SSH for the transport).
See http://rsync.samba.org for details.
There are "rsync" clients for windows, too!
HTH,
Wodisch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2002 08:36 PM
07-22-2002 08:36 PM
Re: how to run FTP through scripts ....
thanks all for your valuable feedback ....
your replies solved my problem ....
thanks again
-bala-