SCRIPT_TIME_START=$(date +%Y%m%dT%H%M%S.%N);
PATH="$HOME/.local/bin:$PATH"; # Add "$(systemd-path user-binaries)" path in case apps saved there
SCRIPT_HOSTNAME=$(hostname); # Save hostname of system running this script.
-SCRIPT_VERSION="0.4.4-alpha2"; # Define version of script.
+SCRIPT_VERSION="0.5.3"; # Define version of script.
SCRIPT_NAME="bkgpslog"; # Define basename of script file.
SCRIPT_URL="https://gitlab.com/baltakatei/ninfacyzga-01"; # Define wesite hosting this script.
AGE_VERSION="1.0.0-beta2"; # Define version of age (encryption program)
# Depends: magicWriteVersion(), appendFileTar()
local FN
+ vbm "DEBUG:STATUS:$FN:Started magicGatherWriteBuffer().";
# Debug:Get function name
FN="${FUNCNAME[0]}";
# Fill buffer
timeout "$BUFFER_TTL"s gpspipe -r -o "$PATHOUT_BUFFER" ;
timeBufferStart="$(dateTimeShort "$(date --date="$BUFFER_TTL seconds ago")")"; # Note start time
- vbm "DEBUG:STATUS:$FN:Started magicWriteBuffer().";
# Determine file paths (time is start of buffer period)
FILEOUT_BASENAME="$timeBufferStart""--""$bufferTTL_STR""..""$SCRIPT_HOSTNAME""_location" && vbm "STATUS:Set FILEOUT_BASENAME to:$FILEOUT_BASENAME";
## Files saved to DIR_TMP
# Remove secured chunks from DIR_TMP
rm "$PATHOUT_BUFFER" "$PATHOUT_NMEA" "$PATHOUT_GPX" "$PATHOUT_KML";
- vbm "DEBUG:STATUS:$FN:Finished magicWriteBuffer().";
+ vbm "DEBUG:STATUS:$FN:Finished magicGatherWriteBuffer().";
} # write buffer to disk
magicParseRecipientDir() {
# Desc: Updates recPubKeysValid with pubkeys in dir specified by '-R' option ("recipient directory")
CMD_CONV_KML="gpsbabel -i nmea -f - -o kml -F - " && vbm "STATUS:Set CMD_CONV_KML to:$CMD_CONV_KML"; # convert NMEA to KML
# MAIN LOOP:Record gps data until script lifespan ends
- timeBufferFirstNS="$(timeEpochNS)"; bufferRound=0; BUFFER_TTL_ADJ_FLOAT="10.0";
+ timeBufferFirstNS="$(timeEpochNS)"; bufferRound=0; BUFFER_TTL_ADJ_FLOAT="$BUFFER_TTL";
while [[ "$SECONDS" -lt "$SCRIPT_TTL" ]]; do
magicParseRecipientDir;
magicGatherWriteBuffer &
- sleep "$BUFFER_TTL_ADJ_FLOAT";
+ sleep "$BUFFER_TTL_ADJ_FLOAT"; # adjusted by magicBufferSleepPID
((bufferRound++));
- magicBufferSleepPID; # Calculates BUFFER_TTL_ADJ from BUFFER_TTL given buffer expected start time vs. actual
+ magicBufferSleepPID; # Calculates BUFFER_TTL_ADJ_FLOAT from BUFFER_TTL given buffer expected start time vs. actual
done
# Cleanup