Our organization has a database maintenance script that runs nightly. Without going into too much detail of the script tasks, the first task is to stop any connections to the GDB and the last step is to open connections back to the GDB. While it is rare, once a blue moon the script will stop during a run and not allow for database connections. We usually find this out when the end users are prompted with an error message the next morning and we have to manually check the box to allow for connections. I should note we do have safeguards in place if the script runs into any geoprocessing errors; the script will send admin users an email message of the error that was encountered and reestablish database connections as a final step. However, there are the strange instances where the script will stop completely with no errors, thus not taking that final step to accept connections.
My questions is: is there a way using python to check if an enterprise geodatabase is accepting connections?
Ideally I would like to write a simple script that performs the following tasks:
1. Check if GDB is accepting connections
2. If yes, end script
3. If no, send an alert message to admins and accept connections