-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_nautk.sh
executable file
·60 lines (49 loc) · 1.77 KB
/
run_nautk.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
56
57
58
59
60
#!/bin/bash
set -o pipefail -o noclobber -o xtrace -e errexit -o nounset
# pass arguments like
# version=12 ./run_nautk.sh
nautilus=~/nk
run_host="${run_host-tinker-2}"
run_host_dns="${run_host_dns-tinker-2.cs.iit.edu}"
run_host_ipmi="${run_host_ipmi-10.47.142.34}"
delete=${delete:-}
if [ -z "${version:-}" ]
then
echo must pass a version, like
echo $ version=12 ./run_linux.sh
exit 1
fi
log=data/nautk_${version}.log
if [ -n "${delete}" ]
then
rm -f "${log}"
fi
echo > "${log}"
# Add version information to log
commit=$(git log -1 --pretty=format:"%h")
echo Git commit ${commit} >> "${log}"
git status >> "${log}"
rm -rf "${nautilus}/src/app" "${nautilus}/include/app"
rm -rf "${nautilus}/src/database" "${nautilus}/include/database"
rm -rf "${nautilus}/src/perf" "${nautilus}/include/perf"
ln -s "$(realpath ./src/app)" "${nautilus}/src/app"
ln -s "$(realpath ./include/app)" "${nautilus}/include/app"
ln -s "$(realpath ./src/database)" "${nautilus}/src/database"
ln -s "$(realpath ./include/database)" "${nautilus}/include/database"
ln -s "$(realpath ./src/perf)" "${nautilus}/src/perf"
ln -s "$(realpath ./include/perf)" "${nautilus}/include/perf"
if ! grep database "${nautilus}/src/Makefile" > /dev/null
then
echo 'obj-$(NAUT_CONFIG_APP_MAIN) += database/' >> "${nautilus}/src/Makefile"
fi
if ! grep perf "${nautilus}/src/Makefile" > /dev/null
then
echo 'obj-$(NAUT_CONFIG_APP_MAIN) += perf/' >> "${nautilus}/src/Makefile"
fi
cd "${nautilus}"
run_host="${run_host}" run_host_dns="${run_host_dns}" run_host_ipmi="${run_host_ipmi}" unbuffer "${nautilus}/run_remote.py" | unbuffer -p tee -a "${log}"
ssh -t "${ipmi_host}" -- env ipmi_host='"'"${run_host_ipmi}"'"' ./ipmitool power cycle
if [ -n "${run_host_dns}" ]
then
run_host_dns="${run_host_dns}" ./wait_for.sh
fi