GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Capturing ftp status codes in a UNIX script
Operating System - HP-UX
1849495
Members
6867
Online
104044
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
back
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
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
08-29-2001 09:31 AM
08-29-2001 09:31 AM
Capturing ftp status codes in a UNIX script
I need to capture ftp status codes during ftp implementation inside a unix script.
Hv tried using the command line
ftp -n < (ftp.template) >> (target.file)
but seems that this is not capturing the step by step implementation of the ftp process
during a successful transmission, only the below status was captured
200 UMASK set to 022 (was 027)
this is just one of the commands I have used inside the ftp template.
But I also need to capture the status
226 Transfer complete.
How should I do this??
---Many thanks for the advise.
Hv tried using the command line
ftp -n < (ftp.template) >> (target.file)
but seems that this is not capturing the step by step implementation of the ftp process
during a successful transmission, only the below status was captured
200 UMASK set to 022 (was 027)
this is just one of the commands I have used inside the ftp template.
But I also need to capture the status
226 Transfer complete.
How should I do this??
---Many thanks for the advise.
- Tags:
- ftp
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2001 09:37 AM
08-29-2001 09:37 AM
Re: Capturing ftp status codes in a UNIX script
Not sure if I quite understand your problem. You can try with verbose output to see if you are getting what you need.
ftp -v -n < ftp.template >> target_file
-Sri
ftp -v -n < ftp.template >> target_file
-Sri
You may be disappointed if you fail, but you are doomed if you don't try
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2001 09:50 AM
08-29-2001 09:50 AM
Re: Capturing ftp status codes in a UNIX script
You can do it in Perl quite easily:
use Net::FTP;
$ftp = Net::FTP->new('foo.bar.com');
$ftp->login('username','password');
$ftp->cwd('/pub');
$code = $ftp->code;
print("return code is $code\n");
$ftp->quit;
use Net::FTP;
$ftp = Net::FTP->new('foo.bar.com');
$ftp->login('username','password');
$ftp->cwd('/pub');
$code = $ftp->code;
print("return code is $code\n");
$ftp->quit;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2001 07:06 AM
08-30-2001 07:06 AM
Re: Capturing ftp status codes in a UNIX script
The following works:
ftp -n -v <(ftp script) >>(output file)
But what I would really recommend, is :
ftp -n -v <(ftp script) >>(output file) 2>&1
The "-v" tells ftp to display verbose output.
" 2>&1 " directs your standard error to the same place as your standard output. A good idea in case anything ever breaks.
ftp -n -v <(ftp script) >>(output file)
But what I would really recommend, is :
ftp -n -v <(ftp script) >>(output file) 2>&1
The "-v" tells ftp to display verbose output.
" 2>&1 " directs your standard error to the same place as your standard output. A good idea in case anything ever breaks.
"Success is defined by getting up one more time than you fall down."
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2026 Hewlett Packard Enterprise Development LP