Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions bbs/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import datetime
import time
import socket
import bbs.notify

if sys.platform == "win32":
import psutil
#import win32api
Expand Down Expand Up @@ -87,6 +89,14 @@ def call(cmd, check=False):
# Apparently using "stderr=subprocess.STDOUT" fixes this pb.
retcode = subprocess.call(cmd, stderr=subprocess.STDOUT, shell=True)
if check and retcode != 0:
subject = '[BBS] {}'.format(retcode)
bbs.notify.mode = 'do-it'
# TODO: Get notification email from config
bbs.notify.sendtextmail('[email protected]',
['[email protected]'],
subject,
'{}'.format(cmd))
print("Attempted to send notification")
raise subprocess.CalledProcessError(retcode, cmd)
return retcode

Expand Down