run: print 50 lines of server log

This commit is contained in:
Felix Lohmeier 2023-10-26 05:16:15 +00:00
parent f52b83896e
commit 3f205c7e75
4 changed files with 18 additions and 6 deletions

12
orcli
View File

@ -1076,7 +1076,13 @@ EOF
function error() {
echo >&2 "[$(date +'%Y-%m-%dT%H:%M:%S')] ERROR: $1"
shift
for msg in "$@"; do echo >&2 "$msg"; done
for msg in "$@"; do echo >&2 " $msg"; done
if [[ -f "$OPENREFINE_TMPDIR/openrefine.log" ]]; then
echo >&2 "last 50 lines of OpenRefine's server log:"
echo >&2 "-----------------------------------------"
tail >&2 -50 "$OPENREFINE_TMPDIR/openrefine.log"
echo >&2 "-----------------------------------------"
fi
exit 1
}
function log() {
@ -1572,7 +1578,7 @@ orcli_test_command() {
break
fi
if [[ $i == 20 ]]; then
error "starting OpenRefine server failed!" "$(cat "$OPENREFINE_TMPDIR/openrefine.log")"
error "starting OpenRefine server failed!""
fi
done
@ -1864,7 +1870,7 @@ orcli_run_command() {
break
fi
if [[ $i == 20 ]]; then
error "starting OpenRefine server failed!" "$(cat "$OPENREFINE_TMPDIR/openrefine.log")"
error "starting OpenRefine server failed!"
fi
done

View File

@ -3,7 +3,13 @@
function error() {
echo >&2 "[$(date +'%Y-%m-%dT%H:%M:%S')] ERROR: $1"
shift
for msg in "$@"; do echo >&2 "$msg"; done
for msg in "$@"; do echo >&2 " $msg"; done
if [[ -f "$OPENREFINE_TMPDIR/openrefine.log" ]]; then
echo >&2 "last 50 lines of OpenRefine's server log:"
echo >&2 "-----------------------------------------"
tail >&2 -50 "$OPENREFINE_TMPDIR/openrefine.log"
echo >&2 "-----------------------------------------"
fi
exit 1
}
function log() {

View File

@ -62,7 +62,7 @@ for i in {1..20}; do
break
fi
if [[ $i == 20 ]]; then
error "starting OpenRefine server failed!" "$(cat "$OPENREFINE_TMPDIR/openrefine.log")"
error "starting OpenRefine server failed!"
fi
done

View File

@ -42,7 +42,7 @@ for i in {1..20}; do
break
fi
if [[ $i == 20 ]]; then
error "starting OpenRefine server failed!" "$(cat "$OPENREFINE_TMPDIR/openrefine.log")"
error "starting OpenRefine server failed!"
fi
done