I'm trying to get a simple script going which looks at all .log files and greps for a particular string and depending on its value sends an email.
tail -f **/*.log | while read LOGLINE
do
[[ "${LOGLINE}" == *"complete!"* ]] && pkill -P $$ tail |
echo "LOG" | mutt -s "Test Passed!" abc@xyz.com
[[ "${LOGLINE}" == *"FAILURE"* ]] && pkill -P $$ tail |
echo "LOG" | mutt -s "Test Failed!" abc@xyz.com
done
However this gives me the following results:
tail: cannot open `**/*.log' for reading: No such file or directory
tail: no files remaining
If I provide the exact path, the script works fine. How can I make this work for all the .log files in the parent and all sub-folders?