Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qa-deploy-utils
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
QA
qa-deploy-utils
Commits
331daff7
Commit
331daff7
authored
Dec 17, 2017
by
智勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
up
parent
d931539d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
183 deletions
+12
-183
6_start_by_name.sh
qa_shell_script/6_start_by_name.sh
+0
-149
remote_excute_rabbitmq.sh
qa_shell_script/remote_excute_rabbitmq.sh
+0
-22
remote_excute_start.sh
qa_shell_script/remote_excute_start.sh
+12
-12
No files found.
qa_shell_script/6_start_by_name.sh
deleted
100755 → 0
View file @
d931539d
#!/bin/bash
project_name
=
$1
pwd_path
=
"/home/qa-deploy-utils/qa_shell_script"
config_shell_path
=
"
$pwd_path
"
config_server
=
"
$pwd_path
/config_server"
project_type
=
`
node
$config_server
/get_project_config.js
-name
$project_name
-attr
type
`
project_path
=
`
cat
$config_server
/project_path.sh
`
config_path
=
`
cat
$config_server
/config_path.sh
`
node4_path
=
`
cat
$config_server
/node_4_path.sh
`
node7_path
=
`
cat
$config_server
/node_7_path.sh
`
profile
=
test
time
=
`
date
+%Y_%m_%d_%H_%M_%S
`
function
restartJavaProject
()
{
max_wait_log_generate_time
=
50
max_wait_ack_time
=
500
ack_phrase
=
"JVM
\
running
\
for"
project
=
$1
desc
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
desc
`
sh
$config_server
/show_info.sh
$project
重新启动
$desc
cd
$project_path
/
$project
P_UUID
=
`
ps
-ef
|grep
${
project
}
.jar |grep
-v
'grep'
|awk
'{print $2}'
`
if
[
-n
"
${
P_UUID
}
"
]
;
then
echo
"-----KILL
$project
PPID=
${
P_UUID
}
"
echo
`
kill
-9
${
P_UUID
}
`
sleep
2s
fi
echo
"-----project:
$project
while be run command: java -Xmx256m -XX:PermSize64m -Xloggc:/tmp/
${
project
}
.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -jar
${
project
}
.jar --worker 1 --currentWorker 1 -t > /dev/null 2>&1 &"
log_name
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
log_name
`
mv
$project_path
/logs/
$log_name
$project_path
/logs/logs_back/
$project
-
$time
.log
if
[[
$project
==
"redpacket"
]]
;
then
echo
`
java
-Xmx512m
-XX
:PermSize64m
-Xloggc
:/tmp/
${
project
}
.log
-XX
:+PrintGCDetails
-XX
:+PrintGCTimeStamps
-jar
${
project
}
.jar
--worker
1
--currentWorker
1
-t
-ts
>
/dev/null 2>&1 &
`
else
echo
`
java
-Xmx512m
-XX
:PermSize64m
-Xloggc
:/tmp/
${
project
}
.log
-XX
:+PrintGCDetails
-XX
:+PrintGCTimeStamps
-jar
${
project
}
.jar
--worker
1
--currentWorker
1
-t
>
/dev/null 2>&1 &
`
fi
#sleep 30s
ack
"
$ack_phrase
"
$project_path
/logs/
$log_name
${
max_wait_log_generate_time
}
${
max_wait_ack_time
}
}
function
restartNodeProject
()
{
project
=
$1
desc
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
desc
`
stop_command
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
command2
`
sh
$config_server
/show_info.sh
$project
重新启动
$desc
cd
$project_path
/
$project
$stop_command
# forever stop $project
# forever stop $project-www
# pm2 stop $project
start_command
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
command
`
$start_command
# setup_path_temp=`find ./ -maxdepth 2 -path "./node_modules" -prune -o -type f -name "app.js" -print`
# echo "------setup_path_temp:$setup_path_temp"
#
# echo `forever start -a -s --uid $project ${setup_path_temp}`
#
# setup_path_temp_for_appbackent=`find ./ -maxdepth 2 -path "./node_modules" -prune -o -type f -name "www" -print`
# if [ -n "$setup_path_temp_for_appbackent" ];then
# echo "-----project:$project while be run command: python $python_project_path --mode=beta --port=$port > /dev/null 2>&1 &"
# echo `forever start -a -s --uid $project-www ${setup_path_temp_for_appbackent}`
# fi
}
function
restartPythonProject
()
{
project
=
$1
desc
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
desc
`
port
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
port
`
sh
$config_server
/show_info.sh
$project
重新启动
$desc
cd
$project_path
/
$project
setup_path_temp
=
`
find ./
-name
"run.py"
`
python_project_path
=
$project_path
/
$project
${
setup_path_temp
/\.\//\/
}
P_UUID
=
`
ps
-ef
|grep
port
=
$port
|grep
-v
'grep'
|awk
'{print $2}'
`
if
[[
"
${
P_UUID
}
"
!=
""
]]
;
then
echo
"-----KILL
$project
PPID=
${
P_UUID
}
"
echo
`
kill
-9
${
P_UUID
}
`
sleep
3
fi
echo
"-----project:
$project
while be run command: python
$python_project_path
--mode=beta --port=
$port
> /dev/null 2>&1 &"
echo
`
python
$python_project_path
--mode
=
beta
--port
=
$port
>
/dev/null 2>&1 &
`
}
function
restartUiProject
()
{
nginx
-t
;
nginx
-s
reload
}
#acknowledge whether the deploy start OK
function
ack
()
{
ack_phrase
=
"
$1
"
log_path
=
"
$2
"
max_wait_log_generate_time
=
"
$3
"
max_wait_ack_time
=
"
$4
"
wait_log_generate_time
=
0
wait_ack_time
=
0
echo
"begin acknowledge whether the deploy start OK, ACK_PHRASE=
${
ack_phrase
}
, log_path=
${
log_path
}
"
while
[
!
-f
${
log_path
}
]
do
echo
"wait_log_generate_time is
${
wait_log_generate_time
}
, max_wait_log_generate_time is
${
max_wait_log_generate_time
}
"
if
((
${
wait_log_generate_time
}
>
${
max_wait_log_generate_time
}
))
then
echo
"the log generated time exceed the limit"
exit
-1
fi
echo
'the log does not exist, wait for 5 seconds'
sleep
5
let
"wait_log_generate_time+=5"
done
echo
"listen for the log ack..."
for
((
i
=
0
;;
))
do
bootstrap_flag
=
`
cat
${
log_path
}
|grep
"
${
ack_phrase
}
"
|
wc
-l
`
if
[
"
${
bootstrap_flag
}
"
=
0
]
&&
[
"
${
max_wait_ack_time
}
"
-gt
"
${
wait_ack_time
}
"
]
then
sleep
5
let
"wait_ack_time+=5"
echo
"waiting for bootstrap flag for
${
wait_ack_time
}
"
elif
[
"
${
bootstrap_flag
}
"
=
1
]
then
echo
"server is start~"
exit
0
else
echo
"server not startup in
${
max_wait_ack_time
}
seconds..."
exit
-1
fi
done
}
ProjectType
=
`
node
$config_server
/get_project_config.js
-name
$project_name
-attr
type
`
if
[
"
$ProjectType
"
=
"java"
]
;
then
restartJavaProject
$project_name
elif
[
"
$ProjectType
"
=
"node"
]
;
then
restartNodeProject
$project_name
elif
[
"
$ProjectType
"
=
"python"
]
;
then
restartPythonProject
$project_name
elif
[
"
$ProjectType
"
=
"ui"
]
;
then
restartUiProject
$project_name
fi
qa_shell_script/remote_excute_rabbitmq.sh
deleted
100755 → 0
View file @
d931539d
#!/bin/bash
pwd_path_0
=
"/home/qa-deploy-utils"
pwd_path
=
"/home/qa-deploy-utils/qa_shell_script"
config_server
=
"
$pwd_path
/config_server"
project_path
=
`
cat
$config_server
/get_env_ip.sh
`
for
ip_last_num
in
$project_path
do
IP_host
=
`
sh
$pwd_path_0
/get-ip.sh
$ip_last_num
`
expect
-c
"
set timeout 10
spawn ssh root@
${
IP_host
}
expect
\"
]#
\"
send
\"
sh /home/qa-deploy-utils/qa_shell_script/rabbitmq/initial_mq.sh
\r\"
set timeout -1
expect
\"
]#
\"
send
\"
exit
\r\"
expect eof;"
done
qa_shell_script/remote_excute_start.sh
View file @
331daff7
...
...
@@ -4,15 +4,15 @@ pwd_path_0="/home/qa-deploy-utils"
project_name
=
$1
target_ip
=
$2
for
ip_last_num
in
$target_ip
do
IP_host
=
`
sh
$pwd_path_0
/get-ip.sh
$ip_last_num
`
expect
-c
"
set timeout 10
spawn ssh root@
${
IP_host
}
expect
\"
]#
\"
send
\"
sh /home/qa-deploy-utils/qa_shell_script/6_
start_by_name.sh
$project_name
\r\"
set timeout -1
expect
\"
]#
\"
send
\"
exit
\r\"
expect eof;"
done
do
IP_host
=
`
sh
$pwd_path_0
/get-ip.sh
$ip_last_num
`
expect
-c
"
set timeout 10
spawn ssh root@
${
IP_host
}
expect
\"
]#
\"
send
\"
sh /home/qa-deploy-utils/qa_shell_script/5_re
start_by_name.sh
$project_name
\r\"
set timeout -1
expect
\"
]#
\"
send
\"
exit
\r\"
expect eof;"
done
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