Hi,

I have a FTP shell script which is used to move the file from linux server to Windows FTP machine.Here my problem is some times because of network problem the files are not moving to FTP .Here i want to get the mail weather the files are moved to ftp is success or not when the CRONTAB fires to move those file to FTP.Can any one please help .

Here is my shell script

HOST='192.168.2.85'
USER='dump'
PASSWD='und08!'

#FILE='*'

#DT=$(date +%a_%h_%d_%Y)
DT=$(date +%Y-%m-%d)

ftp -n $HOST > .ftpout.txt 2>.ftperr.txt <<END_SCRIPT

quote USER $USER
quote PASS $PASSWD

#lcd /home/oracle/test
lcd /u03/ACADATAEXTRACT/

cd qfund-datawarehouse
mkdir $DT
cd $DT

prompt
mput *
quit

END_SCRIPT
exit 0

Edited 7 Years Ago by John A: added code tags

Hi,

Other wise i want a mail like this if the folder was found and i want the no of file in that folder and get the mail the folder was found and the count of file to my mail .

How to find the file in the FTP server here which command we want to user in SHELL SCRIPT.

Please help me

Hi,

Here i am trying to get the mail weather the files were uploaded successfully or not .For this i am trying in two different ways

1.) Before uploading i would like to ping the ftp server if it is pinging then the files will be uploaded and the get the mail successfully moved.Other wise if it is not pinging i will get the mail not move .

2.) After moving the file to ftp here i will again get those ftp uploaded folder back to the server and if i find the folder in my server then i want to get the success mail other wise not success mail.

Pleas suggest me which is the best one and pleas he me in my code how to use ping command in the script.Here is my script.

#!/bin/bash

HOST='192.168.7.156'
USER='rishna'
PASSWD='tration'

#FILE='*'

#DT=$(date +%a_%h_%d_%Y)

if [  ]
then

DT=$(date +%Y-%m-%d)

ftp -n $HOST > .ftpout.txt 2>.ftperr.txt  <<END_SCRIPT



quote USER $USER
quote PASS $PASSWD

#lcd /home/oracle/test
lcd /u04/dbdump/

cd sample
mkdir $DT
cd $DT
prompt
mput * 

quit

END_SCRIPT


echo "FTP worked  " | mail -s "errors are  " sample@chi.com
	
else
echo "FTP dosent  worked" | mail -s "errors are  " sample@chi.com
fi
This article has been dead for over six months. Start a new discussion instead.