Created
September 24, 2018 12:27
-
-
Save suresh-kumara-gist/e0f482ce6e4276021e397a49383b4295 to your computer and use it in GitHub Desktop.
log_notify-bck.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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