Publish your CQRLOG contact into CRXLOGBOOK.

Soumis par f4eyq le ven 06/08/2021 - 17:15
cqrlog


This article explain how to configure CQRLOG with CRXLOGBOOK.
For info, CQRLOG is an ham radio logger for LINUX, see here : https://www.cqrlog.com/







Install PHP CLI runtime  :

You need PHP 7.3 or more ( 7.4 or 8 ) : 

$> apt-get install php-cli php-common php7.3-cli php7.3-common php7.3-curl php7.3-json php7.3-mysql php7.3-opcache php7.3-readline


Install and configure "sync" program : 

Then you can install the program (here i'm doing the setup as root, but you can also done it with normal user): 

$> mkdir -p /opt/cqrlogcrxsync/work/
$> cd /opt/cqrlogcrxsync/

Retreive code from CRX repository, then install it into /opt/cqrlogcrxsync/

$>  cd /tmp/;mkdir -p /opt/cqrlogcrxsync/work/;
$>  git clone http://git.crx.cloud/f4eyq/crx-cqrlog-syncqsos.git
$>  cp crx-cqrlog-syncqsos/* /opt/cqrlogcrxsync/;
$>  rm -fr /tmp/crx-cqrlog-syncqsos;
$>  cd /opt/cqrlogcrxsync;

$>  cp config.php.example config.php


1. Database configuration : 

You have two methods here depending how you run CQRLOG : 
- CQRLOG MYSQL instance ( run only when CQRLOG is start ), option "save log data to local machine" is check. 
- Local MYSQL instance ( install as service ), option "save log data to local machine" is uncheck.

Case 1, CQRLOG MYSQL instance :  

In this case, the script will use socket file configuration,
The socket path is :  

/home/[YOUR USER]/.config/cqrlog/database/sock

So here i simply edit the config.php and put for example : 

$conf_db_sock='/home/bastien/.config/cqrlog/database/sock';


Case 2, Local MYSQL instance : 

If you run MYSQL as a service (
I can edit now the config.php file : 
Here CQRLOG Mysql database running on  port TCP 3306 with name : "cqrlog001" : 

# netstat -plant | grep mysqld
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      20690/mysqld

# mysql -e 'show databases'
+--------------------+
| Database           |
+--------------------+
| cqrlog001          |

User is simply the "root" , with a password.
So you have to adapt it with your configuration : 

$conf_db_login='root';
$conf_db_pass='mypassword';
$conf_db_host='localhost';
$conf_db_name='cqrlog001';
$conf_db_port='3306';


2. Webservice configuration 

For the "conf_crxapikey" please, generate a Log token from CRX-LOGBOOK
it's explain here see  : 1. CRX-LOGBOOK online 

Token look like for example : "  11-88867c87-f3f4c34a  " 

#CRX webservice info :
$conf_crxserver='ham';
$conf_crxapikey='YOURTOKEN';

Simply change "YOURTOKEN" by you value. 

3. Run the script 

You can now run for the first time the script, here i've more than 50 QSO,
So i have to import it into the CRX-LOGBOOK, you have a documentation here to do that.
before send new QSO ( you can skip this step if you dont want old QSO into your online Logbook ) : 

$> ./syncqsos

CRX service is [online]
CQRLOG Database [online]

Loading QSO index file ( /opt/cqrlogcrxsync/work/cqrlog.index )
-> First time execution, init current index and export QSO(s)
-> There are more thant 14268 QSO into the database,

 Please import your ADIF into CRXLOGBOOK before start syncronisation.

-> Send new QSO(s) if needed. (scan /opt/cqrlogcrxsync/work/ for JSON QSOs files)

#if i launch again the script : 

$> ./syncqsos

CRX service is [online]
CQRLOG Database [online]

Loading QSO index file ( /opt/cqrlogcrxsync/work/cqrlog.index )
-> Current index is : 14268

 Looking for new QSO(s) to export ...
-> Nothing change detected.


Now you can put the script into a CRON like that (as root here, but you can also use your CRON user if you want ) : 

$> crontab -e

# m h  dom mon dow   command
# run log sync every one minute.
*/1 * * * * /opt/cqrlogcrxsync/syncqsos > /dev/null 2> /dev/null


Please note, all new QSOs are send online, you must wait few minutes before see them into the CRX-LOGBOOK Online,

If you want to share QSOs on your QRZ.COM page or blog simply follow this guide.

You have finish  73 !