This commit is contained in:
Joe S 2020-08-11 15:51:20 -04:00
parent 9d04be773f
commit 9872c016d5
4 changed files with 10 additions and 4 deletions

View File

@ -8,7 +8,9 @@ with open ("/etc/bacula/scripts/webhooks/ChrisProEliteMail.md", "r") as myfile:
cleaned_stdout=myfile.read() cleaned_stdout=myfile.read()
if "Termination: Backup OK" in cleaned_stdout: if "Termination: Backup OK" in cleaned_stdout:
truncated_stdout = ["Job Backup-Chris completed with status Backup OK, omitting full report.\nAll data from nextcloud was successfully written to tape on " + mextract(cleaned_stdout, "End time:") + ".\nBackup took " + mextract(cleaned_stdout, "Elapsed time:") + " And used " + mextract(cleaned_stdout, "SD Bytes Written:") + " bytes."] truncated_stdout = ["""Job Backup-Chris completed with status Backup OK, omitting full report.
All data from nextcloud was successfully written to tape on """ + mextract(cleaned_stdout, "End time:") + """.
Backup took """ + mextract(cleaned_stdout, "Elapsed time:") + " And used " + mextract(cleaned_stdout, "SD Bytes Written:") + " bytes."]
else: else:
# Discord limits each message to 2000 chars, if the message is longer than that, truncate it # Discord limits each message to 2000 chars, if the message is longer than that, truncate it
truncated_stdout = [cleaned_stdout[i:i+maxCharPerMessage] for i in range(0, len(cleaned_stdout), maxCharPerMessage)] truncated_stdout = [cleaned_stdout[i:i+maxCharPerMessage] for i in range(0, len(cleaned_stdout), maxCharPerMessage)]

View File

@ -48,4 +48,5 @@
11-Aug 12:43 bacula-dir JobId 310: No Jobs found to prune. 11-Aug 12:43 bacula-dir JobId 310: No Jobs found to prune.
11-Aug 12:43 bacula-dir JobId 310: Begin pruning Files. 11-Aug 12:43 bacula-dir JobId 310: Begin pruning Files.
11-Aug 12:43 bacula-dir JobId 310: No Files found to prune. 11-Aug 12:43 bacula-dir JobId 310: No Files found to prune.
11-Aug 12:43 bacula-dir JobId 310: End auto prune. 11-Aug 12:43 bacula-dir JobId 310: End auto prune.

View File

@ -8,7 +8,9 @@ with open ("/etc/bacula/scripts/webhooks/RoboticsMail.md", "r") as myfile:
cleaned_stdout=myfile.read() cleaned_stdout=myfile.read()
if "Termination: Backup OK" in cleaned_stdout: if "Termination: Backup OK" in cleaned_stdout:
truncated_stdout = ["Job Backup-Robotics completed with status Backup OK, omitting full report.\nAll data from 1721's google drive was successfully written to tape on " + mextract(cleaned_stdout, "End time:") + ".\nBackup took " + mextract(cleaned_stdout, "Elapsed time:") + " And used " + mextract(cleaned_stdout, "SD Bytes Written:") + " bytes."] truncated_stdout = ["""Job Backup-Robotics completed with status Backup OK, omitting full report.
All data from 1721's google drive was successfully written to tape on """ + mextract(cleaned_stdout, "End time:") + """.
Backup took """ + mextract(cleaned_stdout, "Elapsed time:") + " And used " + mextract(cleaned_stdout, "SD Bytes Written:") + " bytes."]
else: else:
# Discord limits each message to 2000 chars, if the message is longer than that, truncate it # Discord limits each message to 2000 chars, if the message is longer than that, truncate it
truncated_stdout = [cleaned_stdout[i:i+maxCharPerMessage] for i in range(0, len(cleaned_stdout), maxCharPerMessage)] truncated_stdout = [cleaned_stdout[i:i+maxCharPerMessage] for i in range(0, len(cleaned_stdout), maxCharPerMessage)]

View File

@ -44,4 +44,5 @@
11-Aug 02:56 bacula-dir JobId 308: No Jobs found to prune. 11-Aug 02:56 bacula-dir JobId 308: No Jobs found to prune.
11-Aug 02:56 bacula-dir JobId 308: Begin pruning Files. 11-Aug 02:56 bacula-dir JobId 308: Begin pruning Files.
11-Aug 02:56 bacula-dir JobId 308: No Files found to prune. 11-Aug 02:56 bacula-dir JobId 308: No Files found to prune.
11-Aug 02:56 bacula-dir JobId 308: End auto prune. 11-Aug 02:56 bacula-dir JobId 308: End auto prune.