Sending a file to 24 Server locations parallely


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sending a file to 24 Server locations parallely
# 8  
Old 02-17-2010
The << characters in the ftp statement indicate that the input for the ftp command will come from the lines following this line until an end of input marker is found.
The end of input marker has to start in column one.
Also add the -i option to the ftp command to suppress confirmation on mput
# 9  
Old 02-19-2010
Hi Unix guru's,

I believe Jit is very Busy and he helped me to come till this point.Can any one help me on this as it is urgent.

Thanks,
meruga

---------- Post updated at 08:50 AM ---------- Previous update was at 08:48 AM ----------

Sorry Jit,

I haven't seen your reply. It is too tight situation from end. i will work on it.

Thanks

---------- Post updated at 09:05 AM ---------- Previous update was at 08:50 AM ----------

Hi Jgt,

Removed the header row(ipaddress,username,password) from the "filelist.txt" file
I have changed my script lines as below:

Code:
ftp -nv  -i<<-!!
	${FTP_SERVER}
	user ${FTP_USER} ${FTP_PASS}
	cd ${FTP_TARGET_DIR}
	 ascii
        prompt
	${FTP_FUNCTION} ${FILE_NAME}
	bye
	!!

And ran the script as below:

etl-kn-t2-etluser : 24ftplocations_i.sh
start
main before while
ip address is 172.22.234.55
username is cipxcd
password is spffg

- FTPing the file from the server
?Invalid command
Not connected.
Not connected.
Not connected.
Interactive mode on.
Not connected.
24ftplocations_i.sh[28]: co_error_check:  not found
- FTPing the file from the server

Ang got the above error.

Last edited by pludi; 02-19-2010 at 10:14 AM.. Reason: code tags!!!
# 10  
Old 02-19-2010
Re-write the actual ftp portion so that it is not indented.
Change the end of input marker from -!! to "EOF"
So:

Code:
ftp -i -nv host <<EOF
user $FTP_USER pass $FTP_PASS
cd $FTP_TARGET_DIR
ascii
$FTP_FUNCTION $FILE_NAME
bye
EOF

You might also consider setting up a .netrc file so that the user and password is not required by the script.
# 11  
Old 02-19-2010
Script running stops at a point

Quote:
Hi Jgt,
I used the same exact script you updated. Fo rthe time being, i am not setting .netrc file as i do not know how to set it.
I am using the existing filelist.txt file which has the below information and it is comma delimeted
filelist.txt:
172.22.234.55,cipxcd,spffg
.
.
When i run the script again, it hangs before echo "main before while".
etl-kn-t2-etluser : 24ftplocations_aj.sh
start
main before while
Please suggest..
Thanks..


---------- Post updated at 10:40 AM ---------- Previous update was at 10:22 AM ----------

Quote:
start
24ftplocations_i.sh[12]: syntax error at line 39 : `<<' unmatched

My Line 39 is as below

ftp -i -nv host <<EOF

Script is updated as below

Code:
 
ftp -i -nv host <<EOF
user ${FTP_USER} pass ${FTP_PASS}
cd $FTP_TARGET_DIR
ascii
$FTP_FUNCTION $FILE_NAME
bye
EOF
co_error_check $? "Failed to ${FTP_FUNCTION} file ${SOURCE_DIR}/${FILE_NAME} to ${FTP_TARGET_DIR}"


# 12  
Old 02-19-2010
The .netrc file exists in the user's home directory and should have permissions of 0600.
The content of the file is:
Quote:
machine 192.168.100.1 login userid password userpass
machine domain.com login userid password userpass
No DNS resolution is done, so the host name on the ftp command line must match the machine name in the .netrc file.

Simplify your script; instead of trying to write the universal solution, put literals into it until you get it to work, get rid of the function, and write an inline solution.
Use building blocks. Get the ftp portion itself to work without any looping, and any variable substitution. Add variables one variable at a time.
# 13  
Old 02-19-2010
not able to execute the code on command line

Quote:
Thanks for your wonderful patience to answer a person like me. I am really new to unix and it is tough time for me.
I tried to frame a comand like this and excuted at prompt the below code:
Code:
 
ftp -i -nv 172.22.234.55 <<EOF
 user cipxcd pass spffg
 cd /dw/cder/stage/vel/srtdia/input/ATRPU
 ascii
 mput IMF_ATRPU_13022010161139.csv
 bye
 EOF

Quote:
And i am not able to excute at the prompt , give enter
I belive i need to give the statement termination at command prompt. Please help on this..

My Output look like below:

etl-kn-t2-etluser : ftp -i -nv 172.22.234.55 <<EOF
user cipxcd pass spffg
cd /dw/cdrsp/stage/velocity/vmedia/input/ATRPU
ascii
mput IMF_ATRPU_13022010161139.csv
bye
> user cipxcd pass spffg
> cd /dw/cdrsp/stage/velocity/vmedia/input/ATRPU
> ascii
> mput IMF_ATRPU_13022010161139.csv
> bye
> EOF
>
>
# 14  
Old 02-19-2010
Try running the ftp portion interactively, without the re-direction (leave the <<EOF) off the line, and without the -n option.

You will be prompted for the userid and password.

Since you are only sending one file, you can use "put" instead of "mput"
If both systems use the same operating system, you can omit the 'ascii' directive, it is only used to covert line endings in text files from CRLF to LF and vice versa.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Web Development

Sending file to WebDav Server

Hi All, I am using a webdav server host name : abc.xyz.com.ak username : user123 password : password123 port : 80 I need to send files stored in my windows system to the server, any idea how to do it. I dont know how to create a url in linux for webdav server using details. (2 Replies)
Discussion started by: prakhar_dubey
2 Replies

2. UNIX for Dummies Questions & Answers

Edit locations in a file

Hi , I have a file which looks like this source1 LEN predictive 392879 394347 0.955489 + . Name=sa000003.1;ID=sa000003;Alias=sa121751.1; source1 LEN descriptive_1 391082 392878 . . . Parent=sa000003.1;supp_id=.1805.1; ... (3 Replies)
Discussion started by: siya@
3 Replies

3. Shell Programming and Scripting

Inserting commas into file at set locations...

Hey everyone. What would be the best method to insert commas (or comma-quotes) into a file at set locations. Every line in the file looks like this: 1234567890123456 123456BIGAUDIODYNAMITE33 123.12 123456 12345678901234MARK E WILLIAMS 123456 The comma's should... (6 Replies)
Discussion started by: Astrocloud
6 Replies

4. Shell Programming and Scripting

Perl: Sending file from UNIX server to Windows server

I'm trying to write a Perl script where a file from a UNIX server box connects to a Windows server box and copies that file into the Window box. The main problem I have right now is that whenever I try to connect to the Windows box, the connection is refused. The error message that always pops... (2 Replies)
Discussion started by: kooshi
2 Replies

5. UNIX for Advanced & Expert Users

Insert Delimiter at fixed locations in a flat file

Hi Can somebody help me with solution for this PLEASE? I have a flat file and need to insert delimiters at fixed positions in all the lines so that I can easily convert into EXCEL with columns defined as per their width. For Example Here is the file { kkjhdhal sdfewss sdtereetyw... (7 Replies)
Discussion started by: jd_mca
7 Replies

6. Shell Programming and Scripting

Perl and sending file to server

Hi, I am trying to write some test code for bigger project where my perl script will send file over to server. This is the current SERVER and CLIENT code I have so far. When I type "hi" from client I get hello back from server and like wise I send send command I get respond back the problem... (1 Reply)
Discussion started by: Dabheeruz
1 Replies

7. Solaris

Sending a file to a server

Dear Experts, please help i am very much confused here and not getting the right path, actually i want to send a file from client to a server, initially i used mmap() which is failing most of the time so i want to use general IO streams to do that, i can open a file in "rb" mode and read... (1 Reply)
Discussion started by: vin_pll
1 Replies

8. Shell Programming and Scripting

executing 2 or more files inside another file parallely

hi All, i have 3 files file1 file2 file3 these 3 files are shell (KSH) scripts. i want to place all these 3 shell scripts in another file file99 and execute these files simultaneoulsy inside the file99 these 3 files should be present and executed simultaneously when i excute file99 (nohup... (1 Reply)
Discussion started by: dareman123
1 Replies

9. Solaris

file locations...

Hi Guys, There was a post that I saw here a while ago regarding file system layout and what to put where, which I am unable to find now.. A user here posted a man page that list what each partition should have in it and what it is used for and were you should install custom packages. ie:... (1 Reply)
Discussion started by: Tornado
1 Replies

10. Programming

sending file from server to client

hi dear i m very new to socket programing . i need the source code which sends file from server to client . i mean both server n client programe which sends file . can u do this for me please my email id is email id removed regards bilal (1 Reply)
Discussion started by: bilal
1 Replies
Login or Register to Ask a Question