- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Using FTP commands in a Script & Running in Cr...
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
08-15-2000 05:50 AM
08-15-2000 05:50 AM
Can anyone with experience in this help me learn?
Your help is greatly appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2000 05:55 AM
08-15-2000 05:55 AM
Re: Using FTP commands in a Script & Running in Cron
With that being said, here is a short a simple FTP script I use:
ftp -n -v
(get, put etc...)
quit
There are numerous past threads discussing the same issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2000 05:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2000 06:00 AM
08-15-2000 06:00 AM
Re: Using FTP commands in a Script & Running in Cron
The simplest way to put it in a script is to create a $HOME/.netrc file with the details on the server you want to connect to so you can log in automatically;
eg. machine
Then you can easily call ftp in a script by doing;
ftp
send
quit
EOF
Thats all you need.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2000 06:03 AM
08-15-2000 06:03 AM
Re: Using FTP commands in a Script & Running in Cron
#!/usr/bin/sh
#
# usage:
#
# batchftp.sh remote-host user-ID pw source-file destination-directory
#
if [ $# -ne 5 ]
then
echo
echo "Usage: $0 remote-host user-ID pw source-file destination-directory"
echo
exit 1
fi
ftp -n << EOF
open $1
user $2 $3
put $4 $5
EOF
It is a general example...you can certainly customize it. The nice part of a shell here document is that environment variables outside the ftp program can be passed to the commands. FTP is also the most efficient method of file transfer and is also quite portable. It has code to translate the myriad of ASCII file formats between different operating systems (ie, DOS vs HP-UX). FTP will adjust the transmission and acknowledgement windows based on the speed of the transmission medium.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2000 11:24 AM
08-15-2000 11:24 AM
Re: Using FTP commands in a Script & Running in Cron
For starters, we didn't want to use SAMBA because it is slow for us, but I learned from other threads on FTP that SAMBA may be slow if you use NetBios name resolution instead of the IP of the server. Knowing that, I tested the use of SAMBA and it now puts at the same speed of normal FTPing.
I also learned of a product called Sharity (http://www.obdev.at/Products/Sharity.html) that treats NT Server shares as mount points on my HP-UX box. This is the answer to our needs. We can have our MF Cobol programs write directly to the server now and don't have to worry about FTPing or using SAMBA. This takes out at least 2 steps.
Thank you all and I hope what I learned helps you someday as you've helped me.