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

 
(ftp.properties)
*****************
# these are the sample valus taken
135.23.34.212 userid password sourcefolder destfolder
 
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..?

you can easily get the properties file values.

property file ftp.properties should have the below values

 
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.

 
. ftp.properties  # (dot or source )
 
echo $RemoteIP
echo userid
1 Like

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..!!