- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- FTP script
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
02-07-2005 10:46 AM
02-07-2005 10:46 AM
FTP script
I need to write a FTP script to connect to various machines. The machine names should be obtained from a separate file. The file would look like
MachineIP AppVersion
......... .........
Now the ftp script should connect to all these machines and get file app_mmddyyyy_* in case the application is in 5.5 version. If the application is in 5.0 version the FTP script should obtain the file app_mmddyy_*.
Also, the FTP script should send error messages to a log file in case it is unable to connect to any of the machine or if the file which it is trying to obtain is not available.
Thanks,
Pat
- Tags:
- ftp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2005 01:37 PM
02-07-2005 01:37 PM
Re: FTP script
1. Where are these files (you must specify the full path to the files)
2. Where are these files going to be stored (as before, you need a full pathname for the destination)
3. How do you determine the version of the application?
Remember, FTP is not a shell and it does not login or have access to special commands. Run the ftp command by hand to see what steps you need (login, password, cd to remote directory, lcd to local directory, etc). To see what commands you have available in FTP, type the ? or help command.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2005 02:36 PM
02-07-2005 02:36 PM
Re: FTP script
How to actually automate:
USER=username
PASS=password
COLLECT=" /home/username/audit"
FILE1=" au_audit.op"
cd /home/ye103910/logftp01
ftp -nv 10.215.15.1 <
user ${USER} ${PASS}
cd ${COLLECT}
get ${FILE1}
quit
FTPEOF
You can actually use this as a function and feed in the information from your data file.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Tags:
- here doc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2005 11:26 PM
02-07-2005 11:26 PM
Re: FTP script
See Clay's answer (the attachment) for using perl to ftp:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=550649
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2005 08:56 AM
02-08-2005 08:56 AM
Re: FTP script
Please find attached the input file to my FTP script. The FTP script should read the IP of the machines which it is suppose to connect from the input file. The input file will be located in a directory called /home/config/.
The FTP script should get the file named app_mmddyyyy_* in case the machine has a version 5.0 in the input file.
The FTP script should get the file named app_mmddyy_* in case the machine has a version 5.5 in the input file.
Also, the FTP script should send error messages to a log file in case it is unable to connect to any of the machines mentioned in the input file or if the file which it is trying to obtain is not available.
Hope it is little clear now.
Thanks,
Pat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2005 09:13 AM
02-08-2005 09:13 AM
Re: FTP script
Reading your input sans the header/blank line is easy:
INFILE=/xxx/myfile
cat ${INFILE} | while read IP VERS
do
echo "IP: ${IP} Version: ${VERS}"
done
Now I will give you the tricky piece, ftpget.pl:
ftpget.pl -h ${IP} -l cstephen -p "topsecret" -d ${REMOTE_DIR} -L 'app_mmddyy_*' | while read FNAME
do
ftpget.pl -h ${IP} -l cstephen -p "topsecret" ${FNAME}
STAT=${?}
done
These are the bare bones of the idea. I'll leave the rest as an exercise. I strongly suggest that you use .netrc files to store the passwd's so that no -p argument is necessary. It's also probably much smarter to use hostnames rather than IP addresses but ftpget.pl will handle either.
Invoke as ftpget.pl -u for full usage. You can also use the -z option to check for remote host connectivity.
- Tags:
- ftpget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2005 10:46 AM
02-08-2005 10:46 AM
Re: FTP script
The files are actually to be stored in the directory /home/logs/.
Can you please suggest me If I could use Anonymous FTP instead of the normal FTP. Anonymous FTP is enabled in all the machines to which I am going to connect.
Also, the requirement is changed little in the sense that the input file will have only the machine names of the machine to which I need to connect. There will not be any version column.
I have to get the file app_mmddyyyy_* from /home/bin/logs directory of the remote machines to which I am connecting.
The script should also write errors to a file /home/config/errors in case if it is not able to connect to any of the machine listed in the input file or if the file is missing in the remote machine.
I am very new to FTP. Please help.
Thanks
Pat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2005 01:05 PM
02-08-2005 01:05 PM