X-Git-Url: https://zdv2.bktei.com/gitweb/EVA-2020-02.git/blobdiff_plain/f5024030c11cd53a1cfdb067f128e3047dff34a2..2eae387d72ea8f49bfd0ebd600fd3aabfc879051:/exec/bklog diff --git a/exec/bklog b/exec/bklog index 9b7fd67..45e6996 100644 --- a/exec/bklog +++ b/exec/bklog @@ -11,7 +11,7 @@ dirTmpDefault="/dev/shm"; # Default parent of working directory # Script Metadata scriptName="bklog"; # Define basename of script file. -scriptVersion="0.1.25"; # Define version of script. +scriptVersion="0.1.27"; # Define version of script. scriptURL="https://gitlab.com/baltakatei/ninfacyzga-01"; # Define wesite hosting this script. scriptTimeStart="$(date +%Y%m%dT%H%M%S.%N)"; # YYYYmmddTHHMMSS.NNNNNNNNN scriptHostname=$(hostname); # Save hostname of system running this script. @@ -1410,8 +1410,9 @@ main() { ### Advance SECONDS the remainder seconds for dividend timeUntilNextDay, divisor bufferTTL if [[ "$(timeUntilNextDay)" -gt "$bufferTTL" ]]; then vbm "DEBUG :$fn:SECONDS currently :$SECONDS"; - SECONDS="$(( $(timeUntilNextDay) % bufferTTL ))" && \ + SECONDS="$(( bufferTTL - ($(timeUntilNextDay) % bufferTTL) ))" && \ vbm "DEBUG :$fn:SECONDS advanced to:$SECONDS"; + vbm "DEBUG :$fn:current time:$(date --iso-8601=seconds)"; fi; ## Init temp working dir try mkdir "$dir_tmp" && vbm "DEBUG :$fn:Working dir created at dir_tmp:$dir_tmp"; @@ -1429,16 +1430,16 @@ main() { bufferRound=0; while [[ $SECONDS -lt "scriptTTL" ]]; do vbm "STATUS:$fn:Starting buffer round:$bufferRound"; - bufferTOD="$(( (1+bufferRound)*bufferTTL ))"; # Set buffer round time-of-death + bufferTOD="$(( (1+bufferRound)*bufferTTL ))" && vbm "DEBUG :$fn:bufferTOD:$bufferTOD"; # Set buffer round time-of-death # Note start time of data collection - timeBufferStartEpoch="$(date +%s)"; + timeBufferStartEpoch="$(date +%s)" && vbm "DEBUG :$fn:timeBufferStartEpoch:$timeBufferStartEpoch"; # Consume stdin to fill buffer until buffer time-of-death (TOD) arrives while read -r -t "$bufferTTL" line && [[ $SECONDS -lt "$bufferTOD" ]]; do # Append line to buffer array buffer+=("$line"); done; # Note end time of data collection - timeBufferEndEpoch="$(date +%s)"; + timeBufferEndEpoch="$(date +%s)" && vbm "DEBUG :$fn:timeBufferEndEpoch:$timeBufferEndEpoch"; # Create dir_tmp if missing if ! [[ -d "$dir_tmp" ]]; then yell "ERROR:$fn:dir_tmp existence failure:$dir_tmp";