![]() ![]() # To invoke startServer(), add a set of parens - that puts it in a subshell: Kill -TERM $pipeParent $(pgrep -P $pipeParent) # Kill the subshell and kids function startServer() ' /proc/$mypid/status) The java process actively doing a file system drop with an 'im alive' message of some sort is probably even easier to wait for. A 'tee' which is able to handle SIGPIPE would probably work better. There are probably better solutions using something else but tail, but I got to give it to you, tail gets you out of the broken-pipe quite nicely. Ok, so a rather crude 'solution', if you're using tail. The -n0 won't read anything already in the file, so you can keep appending to the logfile instead of overwriting it each time, and to standard log rotation on it. The -F will 'read' the file even if it doesn't exist (start reading it when it appears). tail -n0 -F logfile 2>/dev/null | while read -t 30 line It'll cover all cases I can think of (server hangs with no output, server exits, server starts correctly).ĭont forget to start your tail before the server. ![]() Start tail with -pid=$$, that way it'll exit when the bash-process has finished.Put a timeout on the read, tail -f logfile | read -t 30 line.The best answer I can come up with is this ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |