fix(bklog):Fix how procStrings and procFileExts arrays assembled
Default raw data was not being included in output file processing
since procStrings and procFileExts arrays were being completely
overwritten instead of being appended by argProcStrings array
assembled in magicParseProcessStrings() function.
feat(bkgpslog):Add PID control loop for buffer start sched
Add PID loop to adjust time delay between when buffer read-write jobs
are spun off in main while loop. The adjustments are made in order to
keep startup times of write jobs BUFFER_TTL seconds apart. This PID
loop calculation dynamically accounts for any future synchronous
calculations that may be added in the main while loop (including
itself).
feat(bkgpslog):Add PID correction of buffer round timing
Add function to apply PID (proportional, integral, derivative)
adjustments to the sleep period between each buffer round in order to
compensate for lag caused by synchronous calculations between each
buffer round (including the PID adjustment calculation itself).
feat(bkgpslog):Add functions, group code into functions
Add several fucntions to add future new feature (recipient dir watch)
as well as to group existing code blocks into their own functions for
readability. Changes include:
* Add checkAgePubkey() function: checks that a provided string doesn't
throw an error when fed as a recipient string to `age`.
* Pushed several code blocks into their own "magic" functions
** magicParseRecipientDir() : (future feature): To be run at each
buffer session to update the recipient array in response to changes in
a specified recipient directory.
** magicParseRecipientArgs(): Parses strings provided by '-r'
option and format output accordingly. Existing code.
** magicParseCompressionArgs(): Responds to '-c' option by specifying
compression function and output file suffix.
* Update showUsage() to document future '-R' recipient dir option.
chore(bkgpslog):Confirm age can encrypt to ssh pubkey string
Ssh pubkey strings have a space in them which was breaking
appendFileTar() function. 'eval' was used to fix how appendFileTar()
and appendArgTar() execute command strings.
Use eval to build command strings instead of simply putting bare
unquoted variable. This is necessary because the `recipients` variable
used to build a command to encrypt files may contain quotes if one of
the recipients is an ssh key which may have a space:
ssh-rsa AAAAB...
This should fix the inability of `bkgpslog` to accept quoted ssh
pubkey strings as a specified `-r` option argument.
fix(bkgpslog):Reduce logging downtime between buffer rounds
Reduce logging downtime between buffer rounds by moving commands into
the asynchronous `magicWriteBuffer()` function that is spun off
immediately after `gpspipe` has collected data.
Add functionality to `dateTimeShort()` and `dateShort` so the start
time of each saved chunk appended to the `tar` archive can be
calculated indirectly from when `magicWriteBuffer()` starts rather
than performing slow `date` and associated bash variable changes in
the main loop. This start time is needed to name each inserted file as
well as to identify which `tar` file to insert into.
Save gpspipe buffer data `/dev/shm` instead of a Bash variable.
Add `appendFileTar()` function to facilitate reading and processing of
buffer data from `/dev/shm`.
- File writes asynchronous from main script forced to be sequential to
one another to avoid simultaneous writes to same file. Tar write code
consolidated.
- VERSION file format changed to include more fields. VERSION file
generation code cosolidated.
These fields are included to automatically-generated VERSION file
included when a new tar is generated or the script is restarted:
- SCRIPT_VERSION : Version of bkgpslog being run.
- SCRIPT_NAME : Name of the script being run ("bkgpslog").
- SCRIPT_URL : URL where script can be downloaded.
- AGE_VERSION : Version of age (encryption program) used.
- AGE_URL : URL where age can be downloaded.
- DATE : Creation timestamp (ISO-8601).
- HOSTNAME : Hostname of device running script.
- PUBKEY_[n] : Pubkey string used by age to encrypt.
feat(bkgpslog): Consolidate VERSION writing, update functions
Bump version to 0.2.0 from 0.1.0.
style(timeUntilNextDay()). Set as version 1.0.0. Lowercased
returnState variable messages in function return code handling.
fix(timeDuration()). Fix missing $ in bash variable. Set to Version
1.0.0. Removed unused boolean variables.
feat(magicWriteVersion()): Add function to consolidate how VERSION
file is generated; VERSION file can be generated at start or if output
tar goes missing.
feat(magicWriteBuffer()): Take checkMakeTar() exit status into account
in order to determine whether or not to rerun
magicWriteVersion(). Relevant if output tar archive goes missing.
feat(bkgpslog):Force ordered write operations with wait
Use `wait` built-in to force each detached process that appends
location data to the output tar to wait until all other detached
processes complete. This will prevent the magicWriteBuffer() and
appendArgTar() functions from attempting to append to the same tar at
the same time, causing script failure.
feat(bkgpslog):Consolidate write ops into one function
Create metafunction 'magicWriteBuffer' to be triggered for
asynchronous appending of location files into tar file via
appendArgTar function (new) once buffer filled in main logging loop.
Create appendArgTar function to append a bash variable as a file to a
tar file.