-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAlarm.py
50 lines (35 loc) · 1.53 KB
/
Alarm.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import datetime
import time
import smtplib
while (1):
print('Checking')
a=str(datetime.datetime.now().time())
t=((int(a[0:2:1]))*60)+int(a[3:5:1])
txt=open('timestamp.txt','r')
b=str(txt.read())
txt.close()
if b[len(b)-2]=='P':
t2=int(b[len(b)-8:len(b)-6:1])+int(b[len(b)-11:len(b)-9:1])*60+12*60
elif b[len(b)-2]=='A':
t2=int(b[len(b)-8:len(b)-6:1])+int(b[len(b)-11:len(b)-9:1])*60
if ((t-t2)>30):
print('Experiment crashed go check')
server = smtplib.SMTP('smtp.gmail.com', 587)
server.ehlo()
server.starttls()
server.ehlo()
server.login("[email protected]", "Bereal12")
msg = "\nAlarm Labview Not Updating. Please go and check." # The /n separates the message from the headers (which we ignore for this example)
server.sendmail("[email protected]", "[email protected]", msg)
server = smtplib.SMTP('smtp.gmail.com', 587)
server.ehlo()
server.starttls()
server.ehlo()
server.login("[email protected]", "Bereal12")
msg = "\nAlarm Labview Not Updating. Please go and check." # The /n separates the message from the headers (which we ignore for this example)
server.sendmail("[email protected]", "[email protected]", msg)
print('Emails Sent')
else:
print('Running Fine')
minsdel=30
time.sleep(60*minsdel)