Python: Notify if Error
Posted on 2011-02-11
I have a script that stops and starts services on several servers (8). When it finishes, it sends me an email that the script has run successfully. I have the stderr going to a file also. what i want to do is read the file and do the following:
if error exists in output.log then send me an email
if no error exists continue with the script.
I know i need to run this in the loop so that i get an email if there's an error. As it is now, i get an email when it completes looping through all of the servers and stops / restarts the services.
I'm only interested in either how to google examples of what i'm looking for, or resources that help me figure this out. I don't need it done for me. I'm not getting a clear picture of what that looks like in Python.