feat(README):Convert main README to org file from markdown
[EVA-2020-02.git] / exec / bklog
index 819af4b56e2f5bbc59f6e84b12a5d7483b37c900..504ecbc579da321bb6c5f52a51e1cfa0df745ee4 100644 (file)
@@ -11,8 +11,9 @@ dirTmpDefault="/dev/shm"; # Default parent of working directory
 
 # Script Metadata
 scriptName="bklog";             # Define basename of script file.
 
 # Script Metadata
 scriptName="bklog";             # Define basename of script file.
-scriptVersion="0.1.28-test1";          # Define version of script.
+scriptVersion="0.1.29";         # Define version of script.
 scriptURL="https://gitlab.com/baltakatei/ninfacyzga-01"; # Define wesite hosting this script.
 scriptURL="https://gitlab.com/baltakatei/ninfacyzga-01"; # Define wesite hosting this script.
+scriptTimeStartEpoch="$(date +%s)"; # Save start time of script in epoch seconds
 scriptTimeStart="$(date +%Y%m%dT%H%M%S.%N)"; # YYYYmmddTHHMMSS.NNNNNNNNN
 scriptHostname=$(hostname);     # Save hostname of system running this script.
 PATH="$HOME/.local/bin:$PATH";  # Add "$(systemd-path user-binaries)" path in case user apps saved there
 scriptTimeStart="$(date +%Y%m%dT%H%M%S.%N)"; # YYYYmmddTHHMMSS.NNNNNNNNN
 scriptHostname=$(hostname);     # Save hostname of system running this script.
 PATH="$HOME/.local/bin:$PATH";  # Add "$(systemd-path user-binaries)" path in case user apps saved there
@@ -1437,8 +1438,16 @@ main() {
            buffer+=("$line");
        done;
        # Mark time for buffer
            buffer+=("$line");
        done;
        # Mark time for buffer
-       timeBufferEndEpoch="$timeBufferStartEpoch" && vbm "DEBUG :$fn:timeBufferEndEpoch";
-       timeBufferStartEpoch="$(date +%s)" && vbm "DEBUG :$fn:timeBufferStartEpoch";
+       ## Initial time
+       if [[ ! -z "$timeBufferEndEpoch" ]]; then
+           ### Usual case
+           timeBufferStartEpoch="$timeBufferEndEpoch" && vbm "DEBUG :$fn:timeBufferStartEpoch:$timeBufferStartEpoch";
+       else
+           ### Edge case: initial startup
+           timeBufferStartEpoch="$scriptTimeStartEpoch" && vbm "DEBUG :$fn:timeBufferStartEpoch:$timeBufferStartEpoch";
+       fi;
+       ## End Time
+       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";
        # Create dir_tmp if missing
        if ! [[ -d "$dir_tmp" ]]; then
            yell "ERROR:$fn:dir_tmp existence failure:$dir_tmp";