proble in ftp script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting proble in ftp script
# 1  
Old 08-25-2006
proble in ftp script

i had written one script
that make connection with remote host
get some file and close the connection ..
it works fine .. but when i put this scrip in between control structure commands like "if , case " then it give me error like" syntax error at line 26 : `<<' unmatched"

please tell me can we use automated ftp script in control structure
my script is

Code:
Oms_host=$1
oms_login=$2
oms_pass=$3
oms_installation_location=$4


JAR_FILE1=omsconnectors-src.jar
JAR_FILE2=omsconnectors.jar
JAR_FILE3=oms_api.jar


CSV_FILE1=ExternalCreditCheck.csv
CSV_FILE2=GetAddressById.csv
CSV_FILE3=InternalCreditCheck.csv
CSV_FILE4=GetCustomerInfo.csv


echo " INPUT oms host   ${Oms_host} oms login ${oms_login} oms pass ${oms_pass}"
echo " oms_installation_location == ${oms_installation_location}"
echo " INPUT oms host   ${Oms_host} oms login ${oms_login} oms pass ${oms_pass}"


check=Y
if [[${check}= Y]]
       then
         ftp -n ${Oms_host} << EOT
                        user ${oms_login} ${oms_pass}
                        cd ${oms_installation_location}/omsserver
                        get apm.xml
                        cd ..
                        cd AMSS_Configuration
                        get ${JAR_FILE1}
                        get ${JAR_FILE2}
                        cd weblogic
                        get ${JAR_FILE3}
                        bye
                        EOT
       else 
         echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"       
   fi


Last edited by blowtorch; 08-28-2006 at 04:45 AM..
# 2  
Old 08-25-2006
Try:
Code:
ftp -n ${Oms_host} <<-EOF
user ${oms_login} ${oms_pass}
cd ${oms_installation_location}/omsserver
get apm.xml
cd ..
cd AMSS_Configuration
get ${JAR_FILE1}
get ${JAR_FILE2}
cd weblogic
get ${JAR_FILE3}
bye
EOF

# 3  
Old 08-25-2006
thanks for your reply ..
but if i put this script in a control structure block
i mean in (IF ELSE )block ..it does not work

it gives me such error
"syntax error at line 25 : `<<' unmatched"

please help
# 4  
Old 08-25-2006
Code:
[[${check}= Y]]

Should be
Code:
[[ ${check} = Y ]]

# 5  
Old 08-28-2006
Thanks for reply, but this is not a correct reason
Even you put automated ftp script in a function it gives same error
# 6  
Old 08-28-2006
Remove the tab/space characters that you have in the script before the second EOT.
Code:
if [[ ${check} = Y ]]
       then
         ftp -n ${Oms_host} << EOT
                        user ${oms_login} ${oms_pass}
                        cd ${oms_installation_location}/omsserver
                        get apm.xml
                        cd ..
                        cd AMSS_Configuration
                        get ${JAR_FILE1}
                        get ${JAR_FILE2}
                        cd weblogic
                        get ${JAR_FILE3}
                        bye
EOT
       else 
         echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"       
   fi

# 7  
Old 08-28-2006
Thanks blowtorch ,

now its working ... ones again thanks for your reply

I have one more related problem. Hope you will help me.
Scenario is like this
I have one main script, that works fine ... but when I copied this automated ftp script code in my main script
My main script exited after execution of this ftp code ..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Double quotes and variable proble in echo

HI Guys, I want to echo below line in my file :- lpd | grep AL | nawk '{print "1dLA - " $0} How can i echo same Output (4 Replies)
Discussion started by: pareshkp
4 Replies

2. Linux

Need SCP script equivalent to FTP script .

Hi, Currently i'm using the folllowing FTP acript and its working. echo "open $server" > ftp_file echo "user $user $password" >> ftp_file echo "cd $remote_dir" >> ftp_file echo "lcd $local_dir" >> ftp_file echo "put $file">> ftp_file echo "bye" >> ftp_file ftp -nv < ftp_file I've... (1 Reply)
Discussion started by: vickramshetty
1 Replies

3. Shell Programming and Scripting

Automated FTP script using .netrc to multiple FTP servers

Hi all, I'm using the following script to automated ftp files to 1 ftp servers host=192.168.0.1 /usr/bin/ftp -vi >> $bkplog 2>&1 <<ftp open $host bin cd ${directory} put $files quit ftp and the .netrc file contain machine 192.168.0.1 login abc... (4 Replies)
Discussion started by: varu0612
4 Replies

4. Shell Programming and Scripting

passing parameter to ftp script from output of another ftp

Hi, I have a ftp script which first gets all the file names and echo's the latest file. I'm using another ftp command sets to get the file name given by first ftp. The problem is the parameter is not accepted by second ftp. The error message i'm getting is > Rename Temp File calloc:ICMP... (5 Replies)
Discussion started by: ammu
5 Replies

5. Linux

proble in running .properties file

# Timer for thread to sleep thread.sleep =15000 # To run the thread as daemon process thread.run = true # Copy command thread.cmd = C:\Program Files\Java\jdk1.5.0\bin\java CopyFile This is .properties file. CopyFile is name of program. is that ok. if i use cp command inplace of... (0 Replies)
Discussion started by: sari
0 Replies

6. Shell Programming and Scripting

ftp script not able to connect to ftp server.

I have the following ftp script to get files from a remote location. However, on running the script I find that I am not even able to connect to ftp server. I am able to connect to ftp server using other GUI ftp tools like WS_FTP using the same IP. IP used here is a dummy IP. What can go... (3 Replies)
Discussion started by: gram77
3 Replies

7. Shell Programming and Scripting

Awk array proble!!!Please help

I need help with a problem that I have not been able to figure out. I have a file that is about 650K lines. Records are seperated by blank lines, fields seperated by new lines. I was trying to make a report that would add up 2 fields and associate them with a CP. example output would be... (0 Replies)
Discussion started by: timj123
0 Replies

8. Shell Programming and Scripting

FTP script to FTP file to UNIX - Solaris

Hello, A couple of times per week, i receive emails notifications when files are available for processing. Currently i read these eamails with a java program and store the attachement on my C: drive and would now like to generate a PC script to send this file name up to UNIX-Solaris and... (3 Replies)
Discussion started by: bobk544
3 Replies

9. Shell Programming and Scripting

Big (at least to me) sed proble

hi all, i am again surrounded by a big problem,,, i have 2 files file1.txt file2.txt aaaa xxxx xxxxx xxxxxxxxxxxxxxx zzzz zzzz zzz bbb aaaa xx xxxx xxxx xxx zzzz zzzz zzz... (1 Reply)
Discussion started by: go4desperado
1 Replies

10. UNIX for Dummies Questions & Answers

excuting a shell script within ftp script

Novice here... I need help with excuting a shell script on a flat file that I've transfered over from a Windows XP machine for manipulation through an auto FTP script... so that after it is transfers it excutes the shell script and then returns it back to XP machine... Any ideas... (2 Replies)
Discussion started by: Gerry405
2 Replies
Login or Register to Ask a Question