Query related to ftp script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Query related to ftp script
# 1  
Old 10-21-2011
Data Query related to ftp script

Hi,

I was planning to write a FTP script that will FTP files to destination folder. All configuration should be done through a properties files, I have developed two files under /home/499633/scripts) scripts folder, and my main file(ftp_script.sh) should read the properties from the properties file(ftp.properties) .I have already made a properties file naed (ftp.properties) that contain the details like

Code:
 
(ftp.properties)
*****************
# these are the sample valus taken
135.23.34.212 userid password sourcefolder destfolder


Code:
 
The contents of the ftp_script.sh) are 
****************************************
#!/bin/sh 
while read line
do
        RemoteIP=`echo $line | cut -d' ' -f1`
        userid=`echo $line | cut -d' ' -f2`
        passd=`echo $line | cut -d' ' -f3`
        spath=`echo $line | cut -d' ' -f4`
        dpath=`echo $line | cut -d' ' -f5`
        ftp -vin >> ftp.log <<-!
        open $RemoteIP
        user $userid $passd
        cd $dpath
        lcd $spath
        put $file
        bye
        !
done</your/ftp/properties/filepath/ftp.properties

Now my query is that in file ftp_script.sh at the end of the while loop the path of the ftp.properties file would be /home/499633/scripts/ftp.properties would be ok ...?
Second if I execute this script what remote ip denotes here the ip of sender(mine one) or the ip of the reciever..?
# 2  
Old 10-21-2011
you can easily get the properties file values.

property file ftp.properties should have the below values

Code:
 
RemoteIP=123.213.123.13
userid=abcd
passd=xyz
spath=/home/abc/
dpath=/home/xyz

In your main script, source the properties file and use the variables.

Code:
 
. ftp.properties  # (dot or source )
 
echo $RemoteIP
echo userid

This User Gave Thanks to itkamaraj For This Post:
# 3  
Old 10-21-2011
Quote:
Originally Posted by itkamaraj
you can easily get the properties file values.

property file ftp.properties should have the below values

Code:
 
RemoteIP=123.213.123.13
userid=abcd
passd=xyz
spath=/home/abc/
dpath=/home/xyz

In your main script, source the properties file and use the variables.

Code:
 
. ftp.properties  # (dot or source )
 
echo $RemoteIP
echo userid



Hi itkamaraj,

THANKS alot for the guidance, I will change my configuration File as per that same format...But can u please explain the complete structure of the main script file in detail, Thanks in advance..!!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Emergency UNIX and Linux Support

Interfaces related query

I need to list the interfaces that uses FTP instead of SFTP on my applications that are on AIX servers. How do I get that list of IP addresses that connect to my applications via FTP? (2 Replies)
Discussion started by: ggayathri
2 Replies

2. UNIX for Dummies Questions & Answers

query related to grep

Hi All, The result for 'grep "cert_codes" /develop/sales/appl.srce/*.4gl' command will be saved at aa.txt grep "cert_codes" /develop/sales/appl.srce/*.4gl >aa.txt But I am not sure, whether, all result stored in .txt file in case of multi-line result. Please revert back if... (2 Replies)
Discussion started by: pbankar
2 Replies

3. UNIX for Dummies Questions & Answers

A query related to 'ls' command

I am executing the ls command to show the contents of a folder, it shows some number in front of word total as highlighted in blue color below quotes. Can anyone please share that what it is? (2 Replies)
Discussion started by: Zaib
2 Replies

4. Shell Programming and Scripting

datetimestamp related query!

Hi all, I have put a query in a thread but didn't get any reply. Hoping to get a reply here. I have a file in that one line resembles like below... Forwarded by Deepak on 11/15/2009 10:28 AM EST ofcourse AM can be PM also... so what i need is first i need to get only... (1 Reply)
Discussion started by: smarty86
1 Replies

5. Shell Programming and Scripting

query related to if

wht does below statement mean? if wht does dis -d option do?? TIA. (1 Reply)
Discussion started by: sainathdeg
1 Replies

6. Shell Programming and Scripting

Print related query

i Am using the below query and printing the $8 and $9 filed.. find /A/B/C/{1,3,5,7} -name "*.txt" -o -name "*.csv" -o -name "*.TXT" -o -name "*.dat" |xargs ls -ltr |awk '{print $8 ,$9}' > result.xls this give me the rsult like below.. 2008/home/ADMIN/om/1.txt 2008/home/ADMIN/om/hi.txt ... (1 Reply)
Discussion started by: sapan123
1 Replies

7. UNIX for Dummies Questions & Answers

awk related query

hi, I have to extract a column from a file and then updated that column..?? Now i can use wak for extracting it and then how to update it.. $ awk' {print $5}' input_file Can i use sed command here piping it to the output from the awk command.. (2 Replies)
Discussion started by: abhisek.says
2 Replies

8. Shell Programming and Scripting

shell script related query

Hi I have an input to a file. I want the script to return it formatted the input is a number, say , 1234567895 and the output should be 21 43 65 87 59 ,ie, the pair of two digits should be reversed. How can I do this using a shell script? (1 Reply)
Discussion started by: gopsman
1 Replies

9. Shell Programming and Scripting

sed related query

Hi I have a file which looks like this //string = "abcd"; //info //string = "*pqrs"; //add string = "#123"; //sub //string = "#1234567890" data = check(string) //string = "#1234567890" I want to modify this as string = "#987"; //mult data = check(string) How do i do that? (1 Reply)
Discussion started by: gopsman
1 Replies

10. Shell Programming and Scripting

Query related to #!/bin/sh

hi All Why is #!/bin/sh being used in most of the ksh scripts......? I have seen this (#!/bin/sh) being used at the start of the script Regards Suresh (2 Replies)
Discussion started by: sureshg_sampat
2 Replies
Login or Register to Ask a Question