- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Unattended FTPing
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-10-2003 12:42 PM
07-10-2003 12:42 PM
The same sequence of commands works fine when performed manually. Man on ftp in HPUX and HELP on FTP in AS/400 reveal that not all subcommands exist in both versions of FTP.
Any ideas?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2003 12:49 PM
07-10-2003 12:49 PM
SolutionThere are a multitude of script examples and suggestions in thie Forum. A search will easily find them. Here are two possible scripts:
#!/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
07-10-2003 12:49 PM
07-10-2003 12:49 PM
Re: Unattended FTPing
Is your script like this:
#!/bin/sh
#
# FTP printjob
#
#set -x
TIMESTAMP=`/usr/bin/date`
HOSTADDRESS=XXX.XXX.XXX.XXX
FILENAME=`basename $1`
LOGDIR=/somedirectory/
LOGFILE=$LOGDIR$FILENAME.ftplog
XferMode=bi
LOCALDIR=/anotherdirectory
echo "LOGFILE FOR JOB $FILENAME AT $TIMESTAMP" > $LOGFILE
ftp -v $HOSTADDRESS <
$XferMode
lcd $LOCALDIR
put $FILENAME
dir $FILENAME
pass
bye
EndFTP
STATUS=`grep complete $LOGFILE`
if [[ $STATUS != "" ]]; then
ERROR=0
l_rc=0
else
ERROR=1
fi
exit $ERROR
RGds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2003 12:52 PM
07-10-2003 12:52 PM
Re: Unattended FTPing
We do this from and HPUX 11.0 box to an AS/400. Although I don't recall encountering that kind of problem, what we do is have a primary script create a secondary (ftp script). Here is an example of what we do:
## BUILD FTP SCRIPT ##
echo open ip.add.of.as400 > $tmp_file
echo user username password >> $tmp_file
echo cd directory >> $tmp_file
echo lcd directory >> $tmp_file
echo get some_file >> $tmp_file
echo close >> $tmp_file
echo quit >> $tmp_file
## BEGIN FTP ##
ftp -n -v < $tmp_file
We have not had any problems with this arrangement. Runs four times a day everyday.
Hope this helps!
-Bryan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2003 12:54 PM
07-10-2003 12:54 PM
Re: Unattended FTPing
Are you doing something like:
ftp -inv as400 << EOF
user username password
dir
get
put
EOF
You basically just need to emulate what you do manuall with the syntax as above. You might also consider using a .netrc file which allows you to specify a machine name, username and passwd and when you FTP it automatically logs you in. The .netrc has to be in the home directory of the user that is doing the FTP.
The syntax of it is:
# cat .netrc
machine machine_name login user_name password abc123
It's permissions must be 500 and it must be owned by the user that will be using it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2003 12:57 PM
07-10-2003 12:57 PM
Re: Unattended FTPing
The attached example cd to /tmp and starts transferring files listed on the command line.
The best feature of this Perl method is that error checking is very, very easy.
The attached script would be used like this:
ftpput.pl file1 file2 file3
STAT=${?}
if [[ ${STAT} -eq 0 ]]
then
echo "All OK"
else
echo "Bad ${STAT}
fi
It will also automatically retry failed fails but you can easil;y modify it to suit your needs.
NOTE: Perl is not needed on the AS400 box for this to work.