-
Notifications
You must be signed in to change notification settings - Fork 0
/
cron.sh
executable file
·52 lines (46 loc) · 1.3 KB
/
cron.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
#!/bin/sh
rela_path=`dirname $0`
test_path=`cd "$rela_path" && pwd`
run_name=`uname -r`
task_list="hackbench netperf tbench schbench"
email_address="[email protected]"
reboot_cmd="systemctl start kexec.target"
task_notify()
{
local task=$1
local status=$2
if [ -z "$email_address" ]; then
return
fi
if [ $status = "started" ]; then
echo "Time:" $(date '+%F %T') "\nKernel:" `uname -r` "\nMachine:" `hostname` | \
mutt -s "[schedtests]: $task $status" $email_address
elif [ $task = "Testing" ]; then
{
echo "Time:" $(date '+%F %T') "\nKernel:" `uname -r` "\nMachine:" `hostname`
./report.py --baseline $run_name
} | mutt -s "[schedtests]: $task $status" $email_address
else
{
echo "Time:" $(date '+%F %T') "\nKernel:" `uname -r` "\nMachine:" `hostname`
./report.py --testname $task --baseline $run_name
} | mutt -s "[schedtests]: $task $status" $email_address -a cron.log
fi
}
#wait for the system boots up completely
sleep 30
cd $test_path
touch state_machine
for task in $task_list; do
if [ `grep -c $task state_machine` -eq '0' ]; then
task_notify $task "started"
./run-schedtests.sh $task >> cron.log 2>&1
task_notify $task "completed"
echo "$task" >> state_machine
# wait for the notification sent out
sleep 10
$reboot_cmd
exit
fi
done
task_notify "Testing" "completed"