-
Notifications
You must be signed in to change notification settings - Fork 0
/
email_me.sh
55 lines (48 loc) · 1.2 KB
/
email_me.sh
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
51
52
53
54
55
#!/bin/bash
para_count=$#
let para_count1=para_count-1
PENDING_count=0
for ((i=1; i<=$para_count1; i++))
do
count=`sacct -X -n -o State --j ${!i}|grep "PENDING"|wc -l`
let PENDING_count+=count
done
while [ $PENDING_count -ne 0 ]
do
sleep 15
PENDING_count=0
for ((i=1; i<=$para_count1; i++))
do
count=`sacct -X -n -o State --j ${!i}|grep "PENDING"|wc -l`
let PENDING_count+=count
done
done
echo "submit" |mail -s "${!para_count} submit" [email protected]
RUNNING_count=0
for ((i=1; i<=$para_count1; i++))
do
count=`sacct -X -n -o State --j ${!i}|grep "RUNNING"|wc -l`
let RUNNING_count+=count
done
while [ $RUNNING_count -ne 0 ]
do
sleep 15
RUNNING_count=0
for ((i=1; i<=$para_count1; i++))
do
count=`sacct -X -n -o State --j ${!i}|grep "RUNNING"|wc -l`
let RUNNING_count+=count
done
done
COMPLETED_count=0
for ((i=1; i<=$para_count1; i++))
do
count=`sacct -X -n -o State --j ${!i}|grep "COMPLETED"|wc -l`
let COMPLETED_count+=count
done
if [ $COMPLETED_count -eq $para_count1 ]
then
echo "done" |mail -s "${!para_count} done" [email protected]
else
echo "failed" |mail -s "${!para_count} failed" [email protected]
fi