I'd like to integrate the following, similar, question: `tail -f` until text is seen
The proposed solution consists in using the sed command which, when the test is found, exits. Tail will then fail at the next line as the sed is no longer in the pipe and the process will stop:
tail -f /path/to/file.log | sed '/^Finished: SUCCESS$/ q'
My problem is that I have a spring boot log stopping with the line:
org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/opt/tomcat/webapps/my-app.war] has finished in [63,859] ms
This is also the last line of the catalina.out (until a new deploy takes place, that is). For this reason the tail -f command will just hang even though the sed exits and my watcher will stay stuck.
Is there a way to make the entire pipeline immediately fail when sed finds the line?