mirror of
https://github.com/narkoz/hacker-scripts
synced 2025-08-23 10:57:13 +00:00
parent
136636071a
commit
a1716b803f
@ -14,8 +14,16 @@ kumars_email = 'kumar.a@example.com'
|
|||||||
DB_NAME_REGEX = /\S+_staging/
|
DB_NAME_REGEX = /\S+_staging/
|
||||||
KEYWORDS_REGEX = /sorry|help|wrong/i
|
KEYWORDS_REGEX = /sorry|help|wrong/i
|
||||||
|
|
||||||
|
def create_reply(subject)
|
||||||
|
gmail.compose do
|
||||||
|
to kumars_email
|
||||||
|
subject "RE: #{subject}"
|
||||||
|
body "No problem. I've fixed it. \n\n Please be careful next time."
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
gmail.inbox.find(:unread, from: kumars_email).each do |email|
|
gmail.inbox.find(:unread, from: kumars_email).each do |email|
|
||||||
if email.body[KEYWORDS_REGEX] && (db_name = email.body[DB_NAME_REGEX])
|
if email.body.raw_source[KEYWORDS_REGEX] && (db_name = email.body.raw_source[DB_NAME_REGEX])
|
||||||
backup_file = "/home/backups/databases/#{db_name}-" + (Date.today - 1).strftime('%Y%m%d') + '.gz'
|
backup_file = "/home/backups/databases/#{db_name}-" + (Date.today - 1).strftime('%Y%m%d') + '.gz'
|
||||||
abort 'ERROR: Backup file not found' unless File.exist?(backup_file)
|
abort 'ERROR: Backup file not found' unless File.exist?(backup_file)
|
||||||
|
|
||||||
@ -29,11 +37,3 @@ gmail.inbox.find(:unread, from: kumars_email).each do |email|
|
|||||||
gmail.deliver(reply)
|
gmail.deliver(reply)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_reply(subject)
|
|
||||||
gmail.compose do
|
|
||||||
to kumars_email
|
|
||||||
subject "RE: #{subject}"
|
|
||||||
body "No problem. I've fixed it. \n\n Please be careful next time."
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user