|shell script [message #424149]
||Wed, 30 September 2009 06:03
Registered: December 2008
I have shell script which moves the files from linux machine to FTP Windows machine . But some time because of network problem the file are not uploading .Her i need to get the mail weather the files are uploaded or not.
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 help me in my code how to use ping command in the script.Here is my script.
if [ ]
ftp -n $HOST > .ftpout.txt 2>.ftperr.txt <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
echo "FTP worked " | mail -s "errors are " email@example.com
echo "FTP dosent worked" | mail -s "errors are " firstname.lastname@example.org