-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrun.sh
41 lines (33 loc) · 1.53 KB
/
run.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
#!/bin/bash
##==============================================================================================
## load run-time variables
##==============================================================================================
CHECK_TIME=$1
# load current path as base path
BASE_PATH=$(cd "$(dirname "$0")" || exit 1; pwd)
# check if run-time variable exist
if [ ! -d "${BASE_PATH}"/config ] || [ ! -f "${BASE_PATH}"/config/load_variables.sh ]; then
echo "[run.sh] error! fail to load runtime variables"
echo "[run.sh] failed to run!"
exit 1
fi
source "${BASE_PATH}"/config/load_variables.sh
##==============================================================================================
## check script runner to be the same as specified in the config file
##==============================================================================================
if [[ $(whoami) != "${OS_USER}" ]]; then
echo "[run.sh] error! current user is not ${OS_USER}!"
echo "[run.sh] failed to run!"
exit 1;
fi
##==============================================================================================
## executing all check scripts formats print
## this will also generate report in /report and error report in err_report/
##==============================================================================================
if python "${BASE_PATH}"/run/generate_report.py "$BASE_PATH" "$MYSQL_LOGIN_PATH" "$PROMETHEUS_ADDRESS" "$CHECK_TIME"
then
echo "[run.sh] success!"
else
echo "[run.sh] error! failed to run generate_report.py"
exit 1
fi