Skip to content

Commit

Permalink
Merge pull request #1510 from aucampia/iwana-20211216T2046-fuseki_sh_msg
Browse files Browse the repository at this point in the history
Improve error messages from with-fuseki.sh
  • Loading branch information
nicholascar authored Dec 16, 2021
2 parents 8a09f43 + 50ae9f4 commit 1c4c575
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions with-fuseki.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ wait_http_okay() {
return 0
}
kill -0 "${pid}" 2>/dev/null 1>&2 || {
1>&2 echo "ERROR: pid ${pid} (${label}) not running anymore ..."
1>&2 echo "ERROR: pid ${pid} (${label}) not running anymore, see log dump below for the possible cause."
return 1
}
1>&2 echo "INFO: url ${url} (${label}) not okay, waiting ..."
sleep 2
done
1>&2 echo "ERROR: timed out trying to load ${url} (${label})"
1>&2 echo "ERROR: timed out trying to load ${url} (${label}), see log dump below for the possible cause."
return 1
}

Expand All @@ -37,7 +37,7 @@ assert_pid_running() {
done

kill -0 "${pid}" 2>/dev/null 1>&2 || {
1>&2 echo "ERROR: pid ${pid} (${label}) not running anymore ..."
1>&2 echo "ERROR: pid ${pid} (${label}) not running anymore, see log dump below for the possible cause."
return 1
}
1>&2 echo "INFO: pid ${pid} (${label}) running"
Expand Down Expand Up @@ -87,12 +87,20 @@ exit_handler() {
1>&2 echo "WARNING: not killing fuseki fuseki_pid_normal=${fuseki_pid_normal} fuseki_pid_tdb=${fuseki_pid_tdb}"
fi

local -a dump_cmd
if [ -n "${FUSEKI_DUMP_FULL_LOGS}" ]
then
dump_cmd=(cat)
else
dump_cmd=(tail -15)
fi

if [ -n "${FUSEKI_DUMP_LOGS}" ] || [ "${xrc}" != "0" ]
then
1>&2 echo "dumping fuseki_log_normal=${fuseki_log_normal}"
cat "${fuseki_log_normal}" || :
"${dump_cmd[@]}" "${fuseki_log_normal}" || :
1>&2 echo "dumping fuseki_log_tdb=${fuseki_log_tdb}"
cat "${fuseki_log_tdb}" || :
"${dump_cmd[@]}" "${fuseki_log_tdb}" || :
fi
}

Expand Down

0 comments on commit 1c4c575

Please sign in to comment.