With a bash script I'm trying to start a process, wait for it to write a specific string to stdout (i.e. 'Server Initialized'), and then send it to the background and continue with the script. Even better if once 'Server Initialized' is printed the process output is ignored (redirected to /dev/null?)
As a hack right now I'm waiting 10 seconds and assuming the server has started.
( ./long_running_process ) > /dev/null 2>&1 &
# sleep 10
echo 'I run after long_running_process prints "Server Initialized"
Bonus points if, after some timeout, the search string hasn't appeared then exit with an error status code.