I make a script to export fast my daily QSO
You make a file example mydailylog.sh and put inside.
Edit and put your station callsign.
QSOs are exported at log.adi file
See post #2
I make a script to export fast my daily QSO
You make a file example mydailylog.sh and put inside.
Edit and put your station callsign.
QSOs are exported at log.adi file
See post #2
There is currently 1 user online.
Hi!
A good idea and shows how SQL based log can be used in many ways also outside of Cqrlog.
Some notes:
- Cqrlog must be running while this script is run, otherwise there is no sock to access database. To make it handy this script should be (or be called from) ~/.config/cqrlog/stop.sh to be run automated when Cqrlog closes.
- There is no date in filename to show what date it was created.
- There are no reports saved, they are needed for complete qso
- putting script to Forum may have cut something. There should be "done" to close the "do" loop.
- output from script is not adif formatted (no tags). How ever there are lengths taken from items and this looks like perhaps tag design was dropped out.
- There is no header end "EOH" and no qso record ends "EOR"
I did some improvements to this fine idea:
#----cut-----------
#!/bin/bash
today=$(date +%Y-%m-%d_%H:%M)
logfile="/home/$USER/tmp/log$today.adi"
#header
echo "Logfile $today" > $logfile
echo >> $logfile
echo "<EOH>" >> $logfile
#SQL fetch
mysql --socket=/home/$USER/.config/cqrlog/database/sock cqrlog005 -e \
"select band,freq,mode,callsign,qsodate,time_on,time_off,rst_s,rst_r \
from cqrlog_main where qsodate BETWEEN date(NOW()- INTERVAL 1 DAY) and date(NOW());"
mysql --socket=/home/$USER/.config/cqrlog/database/sock cqrlog005 -NBe \
"select band,freq,mode,callsign,qsodate,time_on,time_off,rst_s,rst_r \
from cqrlog_main where qsodate BETWEEN date(NOW()- INTERVAL 1 DAY) and date(NOW());" |
#Read SQL results
while IFS= read -r line
do
band=$(echo "$line" | awk '{print $1;}')
bandn=${#band}
freq=$(echo "$line" | awk '{print $2;}')
freqn=${#freq}
mode=$(echo "$line" | awk '{print $3;}')
moden=${#mode}
call=$(echo "$line" | awk '{print $4;}')
calln=${#call}
qso_date=$(echo "$line" | awk '{print $5;}' | sed -r 's/-//g')
qso_daten=${#qso_date}
stationn=${#station}
time_on=$(echo "$line" | awk '{print $6;}' | sed -r 's/://g')
time_onn=${#time_on}
time_off=$(echo "$line" | awk '{print $7;}' | sed -r 's/://g')
time_offn=${#time_off}
rsts=$(echo "$line" | awk '{print $8;}')
rstsn=${#rsts}
rstr=$(echo "$line" | awk '{print $9;}')
rstrn=${#rstr}
echo "<QSO_DATE:$qso_daten>$qso_date<TIME_ON:$time_onn>$time_on<TIME_OFF:$time_offn>$time_off\
<STATION_CALLSIGN:$stationn>$station<CALL:$calln>$call<MODE:$moden>$mode<FREQ:$freqn>$freq\
<BAND:$bandn>$band<RST_SENT:$rstsn>$rsts<RST_RCVD:$rstrn>$rstr<EOR>" >> $logfile
done
#Show ADI file
cat $logfile
#----cut-----------
--
Saku
OH1KH
Saku you are right, something cut off in the end.
Thank you for your notes.
This is brilliant! Many thanks for the effort on this. I had thought about working on something like this for a while but never jumped in and did it. Now I find it here - thanks!
N1KX