Me di cuenta de que tengo que añadir la de enviar por correo electrónico el código de la secuencia de comandos de python. Yo era capaz de encontrar este documento de ayuda que bastante mucho puesto que el proceso para mí. He hecho algunos ajustes menores y se acercó con:
import smtplib, time, arcpy, arceditor
#block new connections to the database.
arcpy.AcceptConnections('Database Connections/MyConnection.sde', False)
# wait 5 minutes
time.sleep(300)
# Disconnect all users from the database.
arcpy.DisconnectUser('Database Connections/MyConnection.sde', "ALL")
# Get a list of versions to pass into the ReconcileVersions tool.
versionList = arcpy.ListVersions('Database Connections/MyConnection.sde')
# Execute the ReconcileVersions tool.
arcpy.ReconcileVersions_management('Database Connections/MyConnection.sde', "ALL_VERSIONS", "sde.DEFAULT", versionList, "LOCK_ACQUIRED", "ABORT_CONFLICTS", "BY_OBJECT", "FAVOR_TARGET_VERSION", "POST", "KEEP_VERSION", "c:/path/to/log.txt")
# Run the compress tool.
arcpy.Compress_management('Database Connections/MyConnection.sde')
#Allow the database to begin accepting connections again
arcpy.AcceptConnections('Database Connections/MyConnection.sde', True)
# Get Messages
ScriptMessages = arcpy.GetMessages()
# Send Email when script is complete
SERVER = "mailserver.yourcompany.com"
FROM = "GIS Admin <mail@yourcompany.com>"
TO = "johndoe@yourcompany.com"
SUBJECT = "The Script Has Completed"
MSG = "This is an auto generated Message.\n\rThe Reconcile & Compress script has completed.\n\n" + ScriptMessages
# Prepare actual message
MESSAGE = """\
From: %s
To: %s
Subject: %s
%s
""" % (FROM, ", ".join(TO), SUBJECT, MSG)
# Send the mail
server = smtplib.SMTP(SERVER)
server.sendmail(FROM, TO, MESSAGE)
server.quit()