fix(bkgpslog):Fix output files having the same names
authorSteven Baltakatei Sandoval <baltakatei@gmail.com>
Wed, 1 Jul 2020 21:42:21 +0000 (21:42 +0000)
committerSteven Baltakatei Sandoval <baltakatei@gmail.com>
Wed, 1 Jul 2020 21:42:21 +0000 (21:42 +0000)
exec/bkgpslog

index 6995f8667574b69d1544cdc3aed639db4b9a2b9b..d44788661b4f9d6ece2089e39cde3e7df8fe2b3d 100755 (executable)
@@ -727,10 +727,10 @@ main() {
     
     # Record gps data until script lifespan ends
     declare debugCounter; debugCounter="0"; # set debug counter
-    timeStart=$(dateTimeShort); # Note start time
     while [[ "$SECONDS" -lt "$scriptTTL" ]]; do
+       timeBufferStart="$(dateTimeShort)"; # Note start time
        # Determine file paths (time is start of buffer period)
-       FILEOUT_BASENAME="$timeStart""--""$bufferTTL_STR""..""$SCRIPT_HOSTNAME""_location" && vbm "STATUS:Set FILEOUT_BASENAME to:$FILEOUT_BASENAME";
+       FILEOUT_BASENAME="$timeBufferStart""--""$bufferTTL_STR""..""$SCRIPT_HOSTNAME""_location" && vbm "STATUS:Set FILEOUT_BASENAME to:$FILEOUT_BASENAME";
        ## Files saved to DIR_TMP
        PATHOUT_NMEA="$DIR_TMP"/"$FILEOUT_BASENAME".nmea"$CMD_COMPRESS_SUFFIX""$CMD_ENCRYPT_SUFFIX" && vbm "STATUS:Set PATHOUT_NMEA to:$PATHOUT_NMEA";
        PATHOUT_GPX="$DIR_TMP"/"$FILEOUT_BASENAME".gpx"$CMD_COMPRESS_SUFFIX""$CMD_ENCRYPT_SUFFIX" && vbm "STATUS:Set PATHOUT_GPX to:$PATHOUT_GPX";
@@ -765,7 +765,7 @@ main() {
        # Remove secured chunks from DIR_TMP
        try rm "$PATHOUT_NMEA" "$PATHOUT_GPX" "$PATHOUT_KML";
        # Reset buffer and filenames
-       unset bufferBash FILEOUT_BASENAME PATHOUT_NMEA PATHOUT_GPX PATHOUT_KML PATHOUT_TAR;
+       unset bufferBash FILEOUT_BASENAME PATHOUT_NMEA PATHOUT_GPX PATHOUT_KML PATHOUT_TAR timeBufferStart;
        vbm "DEBUG:Completed buffer session $debugCounter ." 1>&2;
        ((debugCounter++))
     done