Writing a simple bash script to do some checks for me in the morning:
One part is pulling down some html files and making sure that they exist.
The other part is ensuring some local files are present, and emailing if they are not.
The problem I am facing is that I am receiving a "syntax error: unexpected end of file" and I can't really understand why it i occuring.
Here is a simplified version of the code:
for myHost in $HOSTS
result=$(wget -T $TIMEOUT -t 1 $myHost -O /dev/null -o /dev/stdout)
result2=$(echo $result | grep "awaiting response")
connected=$(echo $result | grep "404");
if [ "$connected" != "" ]; then
for myEMAIL in $EMAIL
echo -e "$(date) - $myHost is down! \n This is an automated message." | mailx -r "box.email.com" -s "$SUBJECT" $myEMAIL
numoffiles=`find . -maxdepth 1 -mtime -1 | grep -i .html | wc -l`
if [ "$numoffiles" -ne 5 ]; then
FILE=$(find . -maxdepth 1 -mtime -1 -print| grep -i .html)
mailx -r "box.email.com" -s "FILE MISSIN" "$EMAIL" << EOF
from using sh -x I can see that it gets to assigning the number of reports to the var "numoffiles", but then it just believes that is the end of the file. has anyone got any suggestions?