Added database restore

This commit is contained in:
Tanay Karve 2019-04-14 22:39:02 +07:00 committed by GitHub
parent 64f2d1b7dc
commit ed8e5d2f2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,7 @@ import re
import gmail
import yagmail
import os
from hackerutils import get_dotenv
@ -36,6 +37,7 @@ def main():
for mail in g.inbox().mail(unread=True, sender=KUMAR_EMAIL, prefetch=True):
if KEYWORDS_REGEX.search(mail.body):
# Restore DB and send a reply.
os.system('gunzip #{backup} | psql #{dbname}')
mail.add_label('Database fixes')
send_reply(mail.subject)