Hello experts,
I've got the following script that is supposed to FTP a file to another box.
#!/usr/bin/ksh
while read line
do
HOST=`echo "$line" | cut -d" " -f1`
USER=`echo "$line" | cut -d" " -f2`
PASSWD=`echo "$line" | cut -d" " -f3`
PATH=`echo "$line" | cut -d" " -f4`
done < Data_FTP.properties
cd ./Datafiles
echo "`pwd`"
file=$1
ftp -n -i -v <<EOF
open $HOST
user $USER $PASSWD
binary
cd $PATH
put $file
bye
EOF
exit
When I execute this script I always get an error as
"ftp: not found"
for this line:
ftp -n -i -v <<EOF
Any idea folks?
REMOTESERVER=97.253.00.001
REMOTEPATH='/usr'
LOGIN='oracle'
PASSWORD='oracle'
cd $LOCALDIR
ftp -n $REMOTESERVER << INPUT_END
quote USER $LOGIN
quote PASS $PASSWORD
hash
bin
cd $REMOTEPATH
prompt off
put $file
bye
INPUT_END
if [ $? -ne 0 ]
then
echo "Error in the FTP file moving. on `date` " else
echo "The FTP file is moved successfully.." fi
I dont want any notification for my error ... because i already know that there is an error ... what i want to know is what is the error that we are getting from here.
Ok ... the script is now running but only if i replace the line
ftp -n -i -v <<EOF
with
/usr/bin/ftp -n -i -v <<EOF
Any idea why so?
Are you running the script in a cronjob? Use the full path or add the directory to the PATH variable in your cron file if you run the script in a cronjob.
Regards
I'm not running it from cron ... just executing it manually.