Skip to content

Instantly share code, notes, and snippets.

@greyaperez
Created February 6, 2014 16:12
Show Gist options
  • Save greyaperez/8847286 to your computer and use it in GitHub Desktop.
Save greyaperez/8847286 to your computer and use it in GitHub Desktop.
When Tailed Log matches a string, execute task.
tail -f logfile.log | while read LOGLINE
do
[[ "${LOGLINE}" == *"Server Started"* ]] && pkill -P $$ tail && {DO SOMETHING HERE}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment