-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
60 lines (51 loc) · 1.29 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env sh
# -*- coding: utf-8 -*-
# @author: Yang Liu
# @email: v-yangliu4@microsoft.com
arg_num=$#;
fn_slt=$1;
if [ $arg_num -lt 1 ]; then
echo "usage:\n sh run.sh [options]"
exit 0
fi
localtime=`date +"%Y_%m_%d_%H:%M:%S"`
sql_parse_log_path="repo_parse_${localtime}.log"
help(){
echo "OPTIONS"
echo " -h, --help\tshow list of command-line options"
echo " -t, --test\tunit test for shell script functions"
echo " -p, --parse\tfork a SQL parse process"
echo " -d, --debug\tdebug SQL parse scripts with pudb"
}
sql_parse(){
echo "sql parse begin, log: ${sql_parse_log_path}"
nohup python sql_parse/repo_parse_sql.py > ${sql_parse_log_path} 2>&1 &
}
sql_parse_debug(){
echo "sql parse debug"
#python sql_parse/repo_parse_sql.py
python -m pudb sql_parse/repo_parse_sql.py
}
unit_test(){
echo "input args: $fn_slt"
echo "local time: ${localtime}"
echo "sql parse log path: ${sql_parse_log_path}"
}
main(){
case $fn_slt in
"-h" | "--help")
help
;;
"-t" | "--test")
unit_test
;;
"-p" | "--parse")
sql_parse
;;
"-d" | "--debug")
sql_parse_debug
;;
*) echo "invalid arg: ${fn_slt}"; help
esac
}
main