REL-0.10 Cleanup shell scripts

This commit is contained in:
cytopia 2017-05-24 08:45:53 +02:00
parent 98b0fa8c64
commit 5d556fc310
No known key found for this signature in database
GPG Key ID: 6D56EDB8695128A2
2 changed files with 16 additions and 24 deletions

View File

@ -397,21 +397,19 @@ devilbox_stop() {
devilbox_print_errors() {
_url="${1}"
print_h1 "Error output"
print_h2 "Curl"
print_h2 "[ERROR] Curl"
curl -vv "${_url}" || true
echo
print_h2 "docker-compose ps"
print_h2 "[ERROR] docker-compose ps"
docker-compose ps
echo
print_h2 "docker-compose logs"
print_h2 "[ERROR] docker-compose logs"
docker-compose logs
echo
print_h2 "log files"
print_h2 "[ERROR] log files"
ls -lap log/
sudo find log -type f -exec sh -c 'echo "{}:\n-----------------"; cat "{}"; echo "\n\n"' \;
}
@ -452,8 +450,10 @@ devilbox_test_url() {
_count="$( curl -q "${_url}" 2>/dev/null | grep -c "${_pattern}" || true )"
if [ "${_count}" != "${_number}" ]; then
echo "[ERR]: Found ${_count}/${_number} of '${_pattern}'"
return 1
else
return 0
fi
echo "[OK]: Found ${_count}/${_number} of '${_pattern}'"
return 0
}

View File

@ -74,19 +74,18 @@ DEF_PGSQL="9.6"
#
################################################################################
# Print Headline
print_h1 "Configuration: ${DVL_SRV1}-${DVL_VER1} vs ${DVL_SRV2}-${DVL_VER2}"
###
### Configure
###
print_h1 "Configuration: ${DVL_SRV1}-${DVL_VER1} vs ${DVL_SRV2}-${DVL_VER2}"
devilbox_configure "${DVL_SRV1}" "${DVL_VER1}" "${DVL_SRV2}" "${DVL_VER2}" "${DEF_PHP}" "${DEF_HTTPD}" "${DEF_MYSQL}" "${DEF_PGSQL}"
###
### Download and run
###
print_h1 "Downloading and Run"
devilbox_pull
devilbox_start
devilbox_show
@ -98,27 +97,19 @@ devilbox_show
print_h1 "Testing"
print_h2 "docker-compose"
if devilbox_test_compose; then
echo "[OK]: all container running"
else
if ! devilbox_test_compose; then
devilbox_print_errors "http://localhost/index.php"
exit 1
fi
print_h2 "Testing 'dvlbox-ok: index.php"
if devilbox_test_url "http://localhost/index.php" "dvlbox-ok" "20"; then
echo "[OK]: All 'dvlbox-ok' found"
else
echo "[ERR]: Not all 'dvlbox-ok' found"
print_h2 "Testing 'dvlbox-ok': index.php"
if ! devilbox_test_url "http://localhost/index.php" "dvlbox-ok" "20"; then
devilbox_print_errors "http://localhost/index.php"
exit 1
fi
print_h2 "Testing 'dvlbox-err: index.php"
if devilbox_test_url "http://localhost/index.php" "dvlbox-err" "0"; then
echo "[OK]: No 'dvlbox-err' found"
else
echo "[ERR]: 'dvlbox-err' found"
print_h2 "Testing 'dvlbox-err': index.php"
if ! devilbox_test_url "http://localhost/index.php" "dvlbox-err" "0"; then
devilbox_print_errors "http://localhost/index.php"
exit 1
fi
@ -127,4 +118,5 @@ fi
###
### Stop
###
print_h1 "Shutdown and exit"
devilbox_stop