[TangerineSDR] Bash Scripting Help

Jonathan emuman100 at gmail.com
Tue Sep 6 12:12:26 EDT 2022


Hi All,

I need some assistance in writing a bash script that will run as a cron job
to archive VLF data. The data is recorded in hour-long chunks as files. I
have a cleardown script that will cleardown the oldest files and always
maintain a rotating buffer, so as the newest file is being recorded, the
oldest file is being deleted. What I need now is a way to locate the oldest
file, encode it to flac using vlfrx-tools vtflac utility, then delete the
original file. Here is an example:

find locating the oldest files. There is often more than one and the naming
convention is YYMMDD-HHMMSS. Running the following:

find /data/vlf_32k -type f -mtime +50

prints:

/data/vlf_32k/220904-144416
/data/vlf_32k/220904-150000
...
/data/vlf_32k/220904-230000

Next, we need to encode those files to flac to the archive directory:

vtflac -e /data/vlf_32k/220904-144416 >
/mnt/archive/vlf_32k_flac/220904-144416.fx
vtflac -e /data/vlf_32k/220904-150000 >
/mnt/archive/vlf_32k_flac/220904-150000.fx
...
vtflac -e /data/vlf_32k/220904-230000 >
/mnt/archive/vlf_32k_flac/220904-230000.fx

Finally, delete the original files:

rm /data/vlf_32k/220904-144416
rm /data/vlf_32k/220904-150000
...
rm /data/vlf_32k/220904-230000

I haven't done a lot of bash scripting, so I'm asking if anyone here may
have experience with this. I need the above commands to be executed by a
bash script so it'll complete those commands no matter how many files that
the find utility will find. Sometimes, there will be no files the find
utility locates and the script should just exit. It'll be executed every
hour by cron. Any help or assistance will be appreciated!

Thank you!

Jonathan
KC3EEY
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.tapr.org/pipermail/tangerinesdr_lists.tapr.org/attachments/20220906/83ac6bc9/attachment.html>


More information about the TangerineSDR mailing list