test web server is running

This commit is contained in:
Tjatse 2015-12-29 22:38:52 +08:00
parent 9a0477299a
commit e3d6d4b74c
1 changed files with 12 additions and 6 deletions

View File

@ -76,9 +76,12 @@ line=`netstat -an | grep 9000 | egrep "tcp" | grep "LISTEN" | wc -l`
success "connected"
head "Accessing via http"
body=`curl http://127.0.0.1:9000`
[[ $body =~ "Found" ]] || fail "connect failed"
success "connected"
wget -q --spider "http://localhost:9000"
if [ $? -eq 0 ]; then
success "connected"
else
fail "connect failed"
fi
head "Checking status"
line=`$pg status | grep 'running' | wc -l`
@ -95,9 +98,12 @@ line=`netstat -an | grep 9000 | egrep "tcp" | grep "LISTEN" | wc -l`
success "connected"
head "Accessing via http"
body=`curl http://127.0.0.1:9000`
[ -z $body ] || fail "still accessible"
success "refused"
wget -q --spider "http://localhost:9000"
if [ $? -eq 0 ]; then
fail "still accessible"
else
success "refused"
fi
stop;