Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Watch WAL-E
#! /usr/bin/env python
from boto.ses.connection import SESConnection
import sys
import subprocess
import socket
if __name__ == '__main__':
return_code = 'unknown'
host = socket.getfqdn()
try:
ses_conn = SESConnection()
wal_file = sys.argv[1]
wal_push = '/usr/local/bin/wal-e'
return_code = subprocess.call([wal_push, 'wal-push', wal_file])
except Exception, e:
return_code = str(e)
finally:
if return_code != 0:
ses_conn.send_email(
source = 'xxx@xxx.com',
subject = 'PG WAL Archive Failed!',
body = 'Host: %s\nError: %s' % (host, return_code),
to_addresses = ['yyy@xxx.com'])
sys.exit(1)
else:
sys.exit(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.