From ed8e5d2f2be5bcbf930fe2dd198535dbc73d0e7e Mon Sep 17 00:00:00 2001 From: Tanay Karve Date: Sun, 14 Apr 2019 22:39:02 +0700 Subject: [PATCH] Added database restore --- python3/kumar_asshole.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python3/kumar_asshole.py b/python3/kumar_asshole.py index c85155b..88b17c5 100755 --- a/python3/kumar_asshole.py +++ b/python3/kumar_asshole.py @@ -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)