- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- FTP shell script needed
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
04-04-2003 11:51 PM
04-04-2003 11:51 PM
FTP shell script needed
We were having two HP L3000 servers "vmtac1" & "vmtac2" which are the host names of the two servers.I want to FTP files from "vmtac1" to "vmtac2" from a perticular directory from one server to another server.I want to place the directory path & names in the ".txt" file and another shell script which will read the directories from the ".txt" file and FTP the files from "vmtac1" to "vmtac2" servers.I have written a shell script but it was not reliable because i was not much experienced in the unix shell scripting.Can any one can provide the script.BUt for each and every file i want to use "wait" clause and if any error occurs it to through the error to the "/utf001/dac/out" directory and that script has to through some message once its successfull.
The text file looks like "utf001.txt" which contains as below /utf001/dac/in. That means i want to copy the files from the "./in" directory to another server as mentioned above.The directory stucture as same as in the two servers.The main reason of reading the text file is i dont want to hardcode the dorectory path and name in the shell script.If want to change the directory name i can simple change it in the text file.
Thanks for the advance in help.
Raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2003 02:17 AM
04-05-2003 02:17 AM
Re: FTP shell script needed
Here are some threads with some sample ftp scripts that might help:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x4e1b543254bfd611abdb0090277a778c,00.html
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x74e49200caded5118ff40090279cd0f9,00.html
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xadc85a3e6e0bd6118ff40090279cd0f9,00.html
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2003 02:17 AM
04-05-2003 02:17 AM
Re: FTP shell script needed
This is the shell script like below but it dosent rearch for any file.is it possible to pass any $parameter in the "lcd" or "cd" at the ftp prompt.??
ftp -n 00.000.000.00 <
lcd
cd
mput *
quit
EOF
How can i read directory path from the text file in the local as well as remote system?
Please correct me if i am wrong.thanks.
raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2003 02:21 AM
04-05-2003 02:21 AM
Re: FTP shell script needed
I think you'll need to write a script that reads your text file to get the local and remote directories, and then build the actual ftp script to be executed.
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2003 04:04 AM
04-05-2003 04:04 AM
Re: FTP shell script needed
You may use wget - i am trying to build it on my 11.0 box - i have some issues but i definitely think it can be built.
thereafter, you may run it as follows -
wget --proxy=off --input-file=
in the filename placeholder above, you would specify utf001.txt.
it auto-resumes ftp transfers, in case any error occurs. in fact, you can create bookmarks for particular directory's on the ftp host.
instead of at ftp prompt, typing cd /abc/def/ghi, you may create a bookmark for hostname:/abc/def/ghi as say abcd and say at the ftp prompt open abcd - it has an option of storing or not storing the password and login details.
hope this helps.
- ramd.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2003 04:13 AM
04-05-2003 04:13 AM
Re: FTP shell script needed
command requires the ftp hostname as a last arg...
wget --proxy=off --input-file=
Ignore the line about bookmarks in my previous post - coz it is not right. bookmarks are available with ncftp - not wget.
wget is used for recursive downloads of entire directory structures, while ncftp is an advanced interactive ftp client.
- ramd.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2003 06:33 PM
04-05-2003 06:33 PM
Re: FTP shell script needed
Install this on both boxes:
Secure shell
http://www.software.hp.com/cgi-bin/swdepot_parser.cgi/cgi/displayProductInfo.pl?productNumber=T1471AA
Follow the attached box and you will be able to use the scp command to copy stuff back and forth with no trouble at all. Plus you won't have to hard code passwords into your ftp scripts.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2003 02:15 AM
04-07-2003 02:15 AM
Re: FTP shell script needed
rcp -r /path/directory vmtac2:/path/directory
or
rcp -r vntac1:/path/directory /path/directory
the first commands assumes you are running the script on vmtac1 the second on vmtac2, Or you can even specify both servers in your command line and run it from any machine.
-Emerson
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2003 02:38 AM
04-07-2003 02:38 AM
Re: FTP shell script needed
I've written huge applications which use Net::FTP - alot more robust than Expect, and infinitely more flexible than just using shell.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2003 03:29 AM
04-07-2003 03:29 AM
Re: FTP shell script needed
#!/opt/perl/bin/perl
use English;
use Env;
use Net::FTP;
$host="disney";
$user_name="micky";
$user_password="mouse";
$dest_dir="/tmp";
$file_name="*.tar";
# Create the connection
$ftp=Net::FTP->new($host,debug =>1) or die ("Unable to make connection\n");
# Login
$ftp->login($user_name,$user_password) or die ("Unable to log in\n");
# This is how to assign a return code
$return_code=($ftp->cwd($dest_dir));
# This is where you could check your return code for failure
# Read the commands contents into an array
@file_list=$ftp->ls ($file_name);
# Quit the session
$ftp->quit;
# Process the array - this example just prints it out
foreach (@file_list)
{
print "$_\n";
}
You can make this as complex as you'd like!
Col
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2003 04:42 AM
04-07-2003 04:42 AM
Re: FTP shell script needed
How I have understand your problem. The users on both machine are the same and the directories and files are the same, right ?!
Ok, use this from your local machine to the remote machine
find . -print |cpio -pvumod |remsh
First of all you have to go to the directory from which you want have all sub-dirs to the remote machine and then use the commando I've mentioned above.
Roland