Skip to content

Commit d83f480

Browse files
committed
grep -c <3
1 parent 0507591 commit d83f480

File tree

1 file changed

+5
-1
lines changed
  • scaletest/templates/scaletest-runner/scripts

1 file changed

+5
-1
lines changed

scaletest/templates/scaletest-runner/scripts/lib.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ get_status() {
4242

4343
phase_num=0
4444
start_phase() {
45+
# This may be incremented from another script, so we read it every time.
46+
if [[ -f "${SCALETEST_PHASE_FILE}" ]]; then
47+
phase_num="$(grep -c START: "${SCALETEST_PHASE_FILE}")"
48+
fi
4549
phase_num=$((phase_num + 1))
4650
log "Start phase ${phase_num}: ${*}"
4751
echo "$(date -Iseconds) START:${phase_num}: ${*}" >>"${SCALETEST_PHASE_FILE}"
@@ -68,7 +72,7 @@ get_phase() {
6872
fi
6973
}
7074
get_previous_phase() {
71-
if [[ -f "${SCALETEST_PHASE_FILE}" ]] && [[ $(wc -l "${SCALETEST_PHASE_FILE}" | cut -d' ' -f1) -gt 1 ]]; then
75+
if [[ -f "${SCALETEST_PHASE_FILE}" ]] && [[ $(grep -c START: "${SCALETEST_PHASE_FILE}") -gt 1 ]]; then
7276
grep START: "${SCALETEST_PHASE_FILE}" | tail -n2 | head -n1 | cut -d' ' -f3-
7377
else
7478
echo "None"

0 commit comments

Comments
 (0)