| 1 |
#!/usr/bin/env python3 |
| 2 |
|
| 3 |
# @HEADER |
| 4 |
# ***************************************************************************** |
| 5 |
# TriBITS: Tribal Build, Integrate, and Test System |
| 6 |
# |
| 7 |
# Copyright 2013-2016 NTESS and the TriBITS contributors. |
| 8 |
# SPDX-License-Identifier: BSD-3-Clause |
| 9 |
# ***************************************************************************** |
| 10 |
# @HEADER |
| 11 |
|
| 12 |
# Usage: do-something ; mailmsg.py "something has happened" |
| 13 |
|
| 14 |
# Send email to yourself about something that has happened. This is used as a |
| 15 |
# reminder to check on something so that you can do something else until it is |
| 16 |
# finished. It will send to your git-configured email by default and to |
| 17 |
# [email protected] as a backup. |
| 18 |
|
| 19 |
import sys |
| 20 |
import os |
| 21 |
|
| 22 |
scriptsDir = os.path.abspath(os.path.dirname(sys.argv[0]))+"/cmake/python" |
| 23 |
sys.path.insert(0, scriptsDir) |
| 24 |
|
| 25 |
from GeneralScriptSupport import * |
| 26 |
|
| 27 |
emailAddress = getCmndOutput("git config --get user.email", True, False) |
| 28 |
if not emailAddress: |
| 29 |
emailAddress = os.environ['USER']+"@sandia.gov" |
| 30 |
|
| 31 |
msg = sys.argv[1] |
| 32 |
sysname = os.uname()[1] |
| 33 |
pwd = os.getcwd() |
| 34 |
|
| 35 |
emailBody = ""\ |
| 36 |
+"Message: "+msg+"\n" \ |
| 37 |
+"Machine: "+sysname+"\n" \ |
| 38 |
+"PWD: "+pwd |
| 39 |
|
| 40 |
cmnd = "echo \""+emailBody+"\" | mailx -s \""+msg+"\" "+emailAddress |
| 41 |
print(cmnd) |
| 42 |
os.system(cmnd) |