Skip to content

Instantly share code, notes, and snippets.

@suresh-kumara-gist
Created September 24, 2018 12:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suresh-kumara-gist/e65c4cb7b73e0c0593d4ef1891bd428c to your computer and use it in GitHub Desktop.
Save suresh-kumara-gist/e65c4cb7b73e0c0593d4ef1891bd428c to your computer and use it in GitHub Desktop.
log_notify-bck.sh
#!/bin/bash -e
#flag = true; tail -n-1 -f /Applications/DevDesktop/apache/logs/error_log | while read line; do if [ $flag ]; then echo "$(tail -n3 /Applications/DevDesktop/apache/logs/error_log)" | terminal-notifier$
flag=true;
function trigger_notification(){
# if (( $flag == true )); then
echo "$(tail -n3 /Applications/DevDesktop/apache/logs/error_log)" | terminal-notifier -sound default;
tail -n100 /Applications/DevDesktop/apache/logs/error_log > /tmp/log.txt;
open /tmp/log.txt
error_notify;
# fi;
# flag=false
}
function error_notify(){
# tail -n0 -f /Applications/DevDesktop/apache/logs/error_log | while read line; do trigger_notification(); done #echo "$(tail -n3 /Applications/DevDesktop/apache/logs/error_log)" | terminal-notifier -$
tail -n0 -f /Applications/DevDesktop/apache/logs/error_log | while read -r line; do trigger_notification; break; done # ; done #echo "$(tail -n3 /Applications/DevDesktop/apache/logs/error_log)" | term$
}
error_notify
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment