diff options
author | Tom Ritter <tom@ritter.vg> | 2016-01-31 13:22:08 -0600 |
---|---|---|
committer | Tom Ritter <tom@ritter.vg> | 2016-01-31 13:22:08 -0600 |
commit | 3bea3bae59e7404b286b5bf97a6270270bfadd6c (patch) | |
tree | c9d1d7cf76681420587198d09abda761912c47c4 /jobs/EmailChecker.py | |
parent | 1a8b46d940d3a4bc06700d15307191bb10008ea6 (diff) |
Refactor lots of things to allow you to be notified every so often, instead of every single time.
Diffstat (limited to 'jobs/EmailChecker.py')
-rwxr-xr-x | jobs/EmailChecker.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/jobs/EmailChecker.py b/jobs/EmailChecker.py index 925e0db..939d5b8 100755 --- a/jobs/EmailChecker.py +++ b/jobs/EmailChecker.py @@ -12,6 +12,8 @@ import JobBase class EmailChecker(JobBase.JobBase): def executeEvery(self): return JobBase.JobFrequency.HOUR + def notifyOnFailureEvery(self): + return JobBase.JobFailureNotificationFrequency.EVERYTIME def execute(self): USER = self.config.get('email', 'user') PASS = self.config.get('email', 'pass') @@ -47,9 +49,9 @@ class EmailChecker(JobBase.JobBase): foundSubject = True M.close() M.logout() - if not foundSubject: - #This may not work, but try anyway - self.sendEmail("Email Fetch Failure", logdetails) - return False - else: - return True + + self.logdetails = logdetails + return foundSubject + def onFailure(self): + return self.sendEmail("Email Fetch Failure", self.logdetails) + |