0

i have a question about executing a command if a certain text is in a log file. There is already the article: https://unix.stackexchange.com/questions/12075/best-way-to-follow-a-log-and-execute-a-command-when-some-text-appears-in -the-log. So my question is: is it possible to do one thing for one contained text and something else for another text?

my current code is:

tail -F ~/server/logs/current.log | grep --line-buffered " was stopped. Please stop to prevent Server crashes" | while read; do killall java; done

kind regards,

Tuti Bird

  • The answer of penguin359 in the question you mentioned already shows how to do 2 different actions for 2 different lines of output. – Garo Dec 25 '19 at 14:00
  • Can you explain what is missing from the answers to the question you linked to? They seem to be exactly what you need. – terdon Dec 25 '19 at 15:15

0 Answers0