- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- FTP script not complete
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
Discussions
Discussions
Discussions
Forums
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
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
тАО11-20-2001 10:19 AM
тАО11-20-2001 10:19 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-20-2001 10:23 AM
тАО11-20-2001 10:23 AM
Re: FTP script not complete
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@abc.com');
$ftp->cwd("/downloads");
$ftp->get("testfile.txt");
$ftp->quit;
Believe me, I used to do it in script but this is much cleaner.
Regards, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-20-2001 10:40 AM
тАО11-20-2001 10:40 AM
Re: FTP script not complete
Change the line 'ftp' to 'ftp -i -n'.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-20-2001 10:40 AM
тАО11-20-2001 10:40 AM
SolutionCorrected ur script:
------------------------------
#!/usr/bin/sh
REMOTE=111.222.333.444
USER=user123
PW=password123
DIR=/directory
FILE=*.jef
echo "### Transferring the files from server1 to server2 ###"
ftp -n $REMOTE << EOF
user $USER $PW
cd $DIR
mput $FILE
bye
EOF
------------------------------
Cheers...
Satish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-20-2001 10:43 AM
тАО11-20-2001 10:43 AM
Re: FTP script not complete
ftp << END
open . . .
.
.
.
END
I would suggest using a .netrc file, though, in cases where you are not logging in as "anonymous" or "ftp"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-20-2001 10:49 AM
тАО11-20-2001 10:49 AM
Re: FTP script not complete
echo "binary" > /tmp/pos_ftp.$$
echo "put $jcl_file" >> /tmp/pos_ftp.$$
echo "quit" >> /tmp/pos_ftp.$$
ftp $HOST < /tmp/pos_ftp.$$
The .netrc file in the home directory of the user doing the ftp would specify the host and also the authentication information. If your concerned about the security issue then this would not be good for you because the password is plain text.
Do a man on .netrc for more info.
Tony
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-20-2001 11:09 AM
тАО11-20-2001 11:09 AM
Re: FTP script not complete
Use this,
REMOTE=111.222.333 (remote server's IP address)
USER=user123
PW=password123
DIR=/directory
FILE=*.jef
echo "### Transferring the files from server1 to server2 ###"
ftp -n $REMOTE <
cd $DIR
bin
mput $FILE
EndFTP
Hope this helps.
Regds