-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdevops-sqlynx-ide.sh
More file actions
executable file
·109 lines (84 loc) · 2.29 KB
/
devops-sqlynx-ide.sh
File metadata and controls
executable file
·109 lines (84 loc) · 2.29 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'
plain='\033[0m'
SIGNAL=${SIGNAL:-TERM}
SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
APP_JAR=$(cd "$SHELL_FOLDER/main_application";ls devops-sqlynx-ide-*.jar)
PID=""
CMD=""
cd "$SHELL_FOLDER"
JAVA_PATH="$SHELL_FOLDER/jdk1.8.0_351/"
if [ -d "$JAVA_PATH" ]; then
echo "Use software self provided java environment"
JAVA_EXEC="${JAVA_PATH}/bin/java"
else
echo "Use OS provided java environment, need to confirm java_home and java path correctly"
JAVA_EXEC="java"
fi
echo $($JAVA_EXEC -version)
JAVA_OPTS="
-server
-Xms256m
-Xmx1g
-XX:+UseG1GC
-XX:+UseStringDeduplication
-XX:+HeapDumpOnOutOfMemoryError
-Dfile.encoding=utf-8"
before_show_menu() {
show_menu
}
check() {
echo && echo -n -e "${yellow}Please choose the correct command! ${plain}"
show_menu
}
reset_user() {
default_data_path="$SHELL_FOLDER/data/sqlite.db"
read -p "Please enter the sqlite file path [default is $default_data_path]: " sqlite_path
read -p "Please enter the reset password: " pwd
$JAVA_EXEC $JAVA_OPTS -jar "$SHELL_FOLDER"/main_application/$APP_JAR sqlite 2 "$sqlite_path" user_login password "$pwd" name sqlynx 2>&1
}
data_migration() {
read -p "Please enter the old version sqlite file path (fg. /home/2.0.0/sqlite.db): " old_sqlite_path
# 获取当前脚本的工作目录
default_data_path="$SHELL_FOLDER/data/sqlite.db"
default_sqlPath="$SHELL_FOLDER/config/init_sqlitedb.sql"
$JAVA_EXEC $JAVA_OPTS -jar "$SHELL_FOLDER"/main_application/$APP_JAR sqlite_enterprise "$old_sqlite_path" "$default_data_path" "$default_sqlPath" 2>&1
}
show_menu() {
echo -e "
SQLynx-devops
————————————————
${green}1.${plain} historical version data migration and upgrade
${green}2.${plain} reset admin password
————————————————
"
echo && read -p "Please enter the command [1-2]: [default is 1]: " num
if [ -z "$num" ]; then
num=1
fi
case "${num}" in
1)
data_migration
;;
2)
reset_user
;;
*)
check
;;
esac
}
if [[ $# > 0 ]]; then
case $2 in
"reset_user")
reset_user
;;
"data_migration")
data_migration
;;
esac
else
show_menu
fi