fix(bkgpslog):Move chunk cleanup into magicWriteBuffer func
authorSteven Baltakatei Sandoval <baltakatei@gmail.com>
Thu, 2 Jul 2020 01:24:30 +0000 (01:24 +0000)
committerSteven Baltakatei Sandoval <baltakatei@gmail.com>
Thu, 2 Jul 2020 01:24:30 +0000 (01:24 +0000)
exec/bkgpslog

index 0464968fddcfe73b5b74373e510fecb8f9701232..57b685e9f975ff7bffada7b7745652aaa148863b 100755 (executable)
@@ -668,6 +668,8 @@ magicWriteBuffer() {
     appendArgTar "$bufferBash" "$FILEOUT_NMEA" "$PATHOUT_TAR" "$DIR_TMP" "$CMD_CONV_NMEA" "$CMD_COMPRESS" "$CMD_ENCRYPT"; # Write NMEA data
     appendArgTar "$bufferBash" "$FILEOUT_GPX" "$PATHOUT_TAR" "$DIR_TMP" "$CMD_CONV_NMEA" "$CMD_COMPRESS" "$CMD_ENCRYPT"; # Write GPX file
     appendArgTar "$bufferBash" "$FILEOUT_KML" "$PATHOUT_TAR" "$DIR_TMP" "$CMD_CONV_NMEA" "$CMD_COMPRESS" "$CMD_ENCRYPT"; # Write KML file
+    # Remove secured chunks from DIR_TMP
+    try rm "$PATHOUT_NMEA" "$PATHOUT_GPX" "$PATHOUT_KML";
     yell "DEBUG:STATUS:$FN:Finished magicWriteBuffer()."
 } # bkgpslog write function
 
@@ -826,8 +828,7 @@ main() {
        #     vbm "DEBUG:Appended GPX location data $PATHOUT_GPX to $PATHOUT_TAR";
        # try tar --append --directory="$DIR_TMP" --file="$PATHOUT_TAR" "$(basename "$PATHOUT_KML")" && \
        #     vbm "DEBUG:Appended KML location $PATHOUT_KML to $PATHOUT_TAR";
-       # 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 timeBufferStart;
        vbm "DEBUG:Completed buffer session $debugCounter ." 1>&2;