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
10-24-2001 01:54 PM
10-24-2001 01:54 PM
script 1
ftp -i my_server
user my_id my_password
cd /target_dir
put my_file
quit
script 2
( echo open my_server
sleep 1
echo my_id
sleep 1
echo my_password
sleep 1
echo "cd /target_dir"
sleep 1
ehco "put my_file"
sleep 1
echo quit
) | ftp
Both of these seem to hang at the ftp login. Then when I ctrl-c, they continue with errors.
Any suggestions?
Thanks, Ron
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2001 02:05 PM
10-24-2001 02:05 PM
Re: FTP
In the past, I did this stuff in the shell but now I tend to use Perl because it it so much cleaner.
When I have to do ftp scripting these days, I use perl with the Net::FTP module (available for download at www.perl.org/CPAN). It really makes FTP operations very simple. Any error conditions and timeouts are easy to test for and set.
It's usually something as simple as this (with error checking omitted):
use Net::FTP;
$ftp = Net::FTP->new("remotehost.name", Debug => 0);
$ftp->login("anonymous",'cstephen@xyz.com');
$ftp->cwd("/downloads");
$ftp->get("Testfile.TXT");
$ftp->quit;
As a bonus this works in the wonderful world of Windows as well.
Regards, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2001 02:08 PM
10-24-2001 02:08 PM
Solutionscript 1 will start ftp and then the script will hang until you leave ftp. Then it will try user, cd, put & quit on the command line.
try:
ftp -n my_server << [EOT]
user my_id my_passwd
cd /target
put my_file
bye
[EOT]
Mind to put [EOT] solely on a line, don't add any character or space!
good luck,
Thierry.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2001 02:10 PM
10-24-2001 02:10 PM
Re: FTP
Here are two ways to do this:
#!/usr/bin/sh
ftp -n << EOF
verbose
open thehost
user uuu ppp
get /tmp/stuff
close
EOF
...
#!/usr/bin/sh
{ echo "open thehost
user uuu ppp
hash
mput *
close"
} | ftp -i -n -v 2>&1 | tee /tmp/ftplog.$$
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2001 02:10 PM
10-24-2001 02:10 PM
Re: FTP
To get
======
#!/bin/ksh
[[ $# != 5 ]] && { echo "Usage: $0
{ echo user $1 $2; echo cd $5; echo mget $4; echo quit; } | ftp -i -n $3
To put
======
#!/bin/ksh
[[ $# != 5 ]] && { echo "Usage: $0
{ echo user $1 $2; echo cd $5; echo mput $4; echo quit; } | ftp -i -n $3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2001 02:14 PM
10-24-2001 02:14 PM
Re: FTP
That is the best solution todate! I love it!
Thanks!
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2001 02:38 PM
10-24-2001 02:38 PM
Re: FTP
Thanks also to everyone else. I will try out some of the other solutions, especially the perl one.
Thanks,
Ron