Hi guys,
I am sending the script i created..plzzz check it correct if any mistakes...
.
Plz reply early by today..
here i want to find the files based on date , if files are avaliable i want to send a mail to the user. here there are a total of 43 files. they are constant.
Here is the script..
#!/bin/sh
Date=$(date +"%y%m%d")
find /stage_area/loadfiles/telsims/test/ -type f -name "*$Date" -print > /tmp/testfile.txt
returncode=$? # check here is it right to use like this
if [ $returncode != 0 ]; then
echo " Files are not avaliable"
exit $?
else
# Echo $?
temp=`cat /tmp/testfile.txt`
i = 0
for x in $temp
# echo $?
# Reads the test file and counts the number of lines ie associated to i.
do
i =` expr $i + 1 ` # for each line i increments
#echo $?
done
if [ $i == 43 ]
then # checking the condition that all file are avaliable or not
echo "Files Avalaible You can Start Your Process Now" | mailx -s "File Found"
xyz@domain.com
# If condition trues sends an email to the user.
rm -rf /tmp/testfile.txt # removing the test file.
break
fi
fi
Moderator's Comments:
|
|
Double post, continued here
|
|