I need something unusual, I guess. I need to start a process, and if that process displays a specific error message, I need to kill that process and restart it.
Something like:
startprocess | grep -i "This is the specific error message" && kill $pidof(startprocess)
Explanation, I need to start the process, check if it echoes any messages and if any of them is the one that I'm waiting, I need to kill that process.
Restarting of the process I can do putting all this in a while loop or something.
Is this possible at all? Is there any easier way to accomplish the same thing?