Hi All

I have created a script which will email output if the file contains data, this works.
But when the file contains 0 data, it tries to email but hangs, when i hit ctrl D, it ask for Cc: address, i then cancel this then it emails me out.
Anyway i can get it to stop hanging and waiting for user intervention???

if [ $filesize -gt 0 ]
then
mailx -s "$subject $day" $destination < $filename
else
mailx -s "$subject2 $day" $destination
fi

Recommended Answers

All 4 Replies

echo "No Data" | mailx -s "$subject2 $day" $destination

Hi

I tried that but it doesnt seem to work probably, as i had data in $filename, but it just ran echo "No Data" | mailx -s "$subject2 $day" $destination. For some reason it didnt pickup the data??


if [ $filesize -gt 0 ]
then
mailx -s "$subject $day" $destination < $filename
else
print "no date" | mailx -s "$subject2 $day" $destination
fi
+ [ 0 -gt 0 ]
+ print no date
+ mailx -s There are no Failed/Terminated jobs

Sorry it worked, being stupid i had the $filesize variable doing the work before the data came in.
Many thanks for your help masijade. :-)

Welcome

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.