Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
deploy_es_synonym
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpha
deploy_es_synonym
Commits
5354884f
Commit
5354884f
authored
Apr 25, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
2170adf6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
22 deletions
+18
-22
check_dynamic_synonym.sh
check_dynamic_synonym.sh
+18
-22
No files found.
check_dynamic_synonym.sh
View file @
5354884f
...
...
@@ -45,49 +45,45 @@ function red() {
LAST_RESULT_FILE
=
"last_total_num.txt"
last_total_num
=
0
if
[[
-e
$LAST_RESULT_FILE
]]
:
then
cat
$LAST_RESULT_FILE
>
$last_total_num
if
[[
-e
$LAST_RESULT_FILE
]]
;
then
last_total_num
=
`
cat
$LAST_RESULT_FILE
`
fi
SQL
=
"select count(1) from api_wordrelsynonym"
results
=(
`
mysql
-h
$MYSQL_HOST
-u
$MYSQL_USER
-p
$MYSQL_PASSWORD
$MYSQL_DB
-e
"
$SQL
"
`
)
new_total_num
=
${
results
[1]
}
new_total_num
=
0
SQL
=
"select count(1) from api_wordrelsynonym group by wordrel_id"
mysql
-h
$MYSQL_HOST
-u
$MYSQL_USER
-p
$MYSQL_PASSWORD
$MYSQL_DB
-e
"
$SQL
"
|
while
IFS
=
read
-r
ROW
do
if
[[
$Counter
-ge
$linestoskip
]]
;
then
$new_total_num
=
$ROW
fi
done
echo
"new_total_num:"
$new_total_num
echo
"last_total_num:"
$last_total_num
Counter
=
0
$
FILE
=
"dynamic_synonym.txt"
$
DICFILE
=
"dynamic_synonym.dic"
FILE
=
"dynamic_synonym.txt"
DICFILE
=
"dynamic_synonym.dic"
if
[[
-e
$FILE
]]
;
then
rm
$FILE
rm
$FILE
fi
if
[[
-e
$DICFILE
]]
;
then
rm
$DICFILE
rm
$DICFILE
fi
if
[[
$last_total_num
!=
$new_total_num
]]
;
then
echo
"begin generate dynamic file..."
SQL
=
"SELECT GROUP_CONCAT(word SEPARATOR ',') FROM api_wordrelsynonym GROUP BY wordrel_id"
mysql
-h
$MYSQL_HOST
-u
$MYSQL_USER
-p
$MYSQL_PASSWORD
$MYSQL_DB
-e
"
$SQL
"
|
while
IFS
=
read
-r
ROW
do
if
[[
$Counter
-ge
$linestoskip
]]
;
then
echo
"
$ROW
"
>>
$FILE
array
=(
${
ROW
//,/
}
)
for
var
in
${
array
[@]
}
do
echo
"
$var
"
>>
$DICFILE
done
echo
"
$ROW
"
>>
$FILE
array
=(
${
ROW
//,/
}
)
for
var
in
${
array
[@]
}
do
echo
"
$var
"
>>
$DICFILE
done
fi
Counter
=
`
expr
$Counter
+ 1
`
done
fi
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment