Skip to content

Commit

Permalink
Polish script
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaolongzuo committed Jan 28, 2019
1 parent 3909934 commit 791a247
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 27 deletions.
23 changes: 6 additions & 17 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,21 @@ RemoteSystemsTempFiles/
.classpath
**/.classpath
Servers/
**/target/**
**/classes/**

#idea
*.iml
*.ipr
*.iws
.idea
.idea/**

**/*.iml
**/*.ipr
**/*.iws
**/.idea
**/.idea/**

**/target/**

**/classes/**

# eclipse

# other
.DS_Store
**/.DS_Store

**/**/target/

**/**/target/**

**/**/test.propertiess

key.txt
key.txt
codeless-framework/0
33 changes: 23 additions & 10 deletions startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,23 @@ echo "Mqbroker start success."
cd $DIR/redis-5.0.3/src && nohup ./redis-server > $DIR/redis-server.log 2>&1 &
echo "Redis start success."

echo "waiting for servers start..."
echo "Waiting for servers start..."

RESULT=`curl -s -X POST -d "dataId=user-center.yaml&group=DEFAULT_GROUP&content=user.id: chenzhu" http://127.0.0.1:8848/nacos/v1/cs/configs`
TIMES=20
TIMES=60

sleep 10

while [ "$RESULT" != "true" ] && [ $TIMES > 0 ]
while [ "$RESULT" != "true" ] && [ $TIMES -gt 0 ]
do
RESULT=`curl -s -X POST -d "dataId=user-center.yaml&group=DEFAULT_GROUP&content=user.id: chenzhu" http://127.0.0.1:8848/nacos/v1/cs/configs`
let TIMES=TIMES-1
sleep 2
echo "Remain $TIMES seconds : Checking servers is started successfully."
sleep 1
done

echo "Servers has been started successfully."

if [ "$RESULT" != "true" ];then
echo "Create config failed."
exit 1
Expand All @@ -97,16 +100,26 @@ echo "sca-user-center start success."
cd $BASE_DIR/sca-best-practice/sca-order && nohup mvn spring-boot:run > $DIR/sca-order.log 2>&1 &
echo "sca-order start success."

RESULT=`curl -I -m 10 -o /dev/null -s -w %{http_code} http://127.0.0.1:9999/user-center/example/testRedis`
TIMES=20
echo "Waiting for applications start..."

RESULT_R=`curl -I -m 10 -o /dev/null -s -w %{http_code} http://127.0.0.1:9999/user-center/example/testRedis`
RESULT_S=`curl -I -m 10 -o /dev/null -s -w %{http_code} http://127.0.0.1:9999/order/example/testService`
TIMES=60

sleep 10

while [ "$RESULT" != "200" ] && [ $TIMES > 0 ]
while [ "$RESULT_R$RESULT_S" != "200200" ] && [ $TIMES -gt 0 ]
do
RESULT=`curl -I -m 10 -o /dev/null -s -w %{http_code} http://127.0.0.1:9999/user-center/example/testRedis`
RESULT_R=`curl -I -m 10 -o /dev/null -s -w %{http_code} http://127.0.0.1:9999/user-center/example/testRedis`
RESULT_S=`curl -I -m 10 -o /dev/null -s -w %{http_code} http://127.0.0.1:9999/order/example/testService`
let TIMES=TIMES-1
sleep 2
echo "Remain $TIMES seconds : Checking applications is started successfully."
sleep 1
done

echo "Servers and applications has been started successfully."
if [ "$RESULT_R$RESULT_S" != "200200" ];then
echo "Applications has been started failed."
exit 1
fi

echo "Applications has been started successfully."

0 comments on commit 791a247

Please sign in to comment.