Skip to content

Instantly share code, notes, and snippets.

@WheezeNL
Last active February 4, 2022 13:27
Show Gist options
  • Save WheezeNL/294b34aceb6d5bd2b3fef6fd89a9762a to your computer and use it in GitHub Desktop.
Save WheezeNL/294b34aceb6d5bd2b3fef6fd89a9762a to your computer and use it in GitHub Desktop.
Install and autostart the G7VJR Clublog-Gateway on Raspberry Pi.

Clublog Gateway on Raspberry Pi with autostart

This was written for Raspbian, change for other user etc. and don't forget to change the KEY in the file!

Basic Installation

Create a folder in your homefolder called clublog, so it will be /home/pi/clublog/

mkdir /home/pi/clublog

Go to the folder, download the gateway-software and unpack it:

cd /home/pi/clublog
wget https://clublog.org/gateway-binaries/clublog-gateway-linux_armv7.gz
gunzip clublog-gateway-linux_armv7.gz

Make the file executable:

chmod +x clublog-gateway-linux_amd64

Rename the file to clublog-gateway:

mv clublog-gateway-linux_armv7 clublog-gateway

Start the gateway without options to see if it works at all:

/home/pi/clublog/clublog-gateway

The output should look something like this:

G7VJR Club Log real-time upload gateway
Version linux/20191203-1023

For help on the command line arguments, try -h.

If this fails due to a glibc of the wrong version, and you are running Debian/Raspbian Stretch, update to Debian/Raspbian Buster!

Now test it with the options you need, for instance:

/home/pi/clublog/clublog-gateway -mode=listener -callsign=ChangeToYourCallSign -password=ChangeThisToYourTopSecretPassword -rate=30

The output should look similar to the following:

G7VJR Club Log real-time upload gateway
Version linux/20191203-1023

00:13:31 Initialised new database file
00:13:31 Opened database file:  /home/pi/clublog/ChangeToYourCallSign.db
00:13:31 No QSOs pending (deadtime: 10s)

If this all works you can move on to automating the startup.

How to automate starting on the Raspberry Pi.

Create a file in /etc/systemd/system/ called clublog.service

sudo nano /etc/systemd/system/clublog.service

Add the following content to the file, where the line after "ExecStart=" should be exactly what you tested earlier! The "WorkingDirectory" is where the database will be placed, the User (pi in this example) should have write-permission in this folder. Keeping it like in the example is recommended.

[Unit]
After=network.target 
Description=Clublog Gateway for PA800D

[Service]
ExecStart=/home/pi/clublog/clublog-gateway -mode=listener -callsign=ChangeToYourCallSign -password=ChangeThisToYourTopSecretPassword -rate=30
WorkingDirectory=/home/pi/clublog/
Restart=on-failure
User=pi

[Install]
WantedBy=multi-user.target

(You can exit with CTRL+X, then Y and enter)

After this you'll have to enter the folling commands, reloading the service-daemon to get it to know the service-file, enabling the clublog-service for automatic start, and starting the service.

systemctl daemon-reload
systemctl enable clublog
systemctl start clublog

After every step you'll need to authenticate, sometimes even twice! I used number 1 every time (pi user) and filed out the password.

==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to restart 'clublog.service'.
Multiple identities can be used for authentication:
 1.  ,,, (pi)
 2.  root
Choose identity to authenticate as (1-2): 1
Password: 
==== AUTHENTICATION COMPLETE ===

If this all goes without errors, the clublog gateway should be started. You can check the status and the last few logfiles with:

systemctl status clublog.service

The output should look something like, but will only show the "No QSOs pending" after a while.

pi@Praspberrypi:/etc/systemd/system $ systemctl status clublog.service
● clublog.service
   Loaded: loaded (/etc/systemd/system/clublog.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2020-01-20 23:48:07 CET; 4s ago
 Main PID: 8327 (clublog-gateway)
    Tasks: 9 (limit: 2200)
   Memory: 1.8M
   CGroup: /system.slice/clublog.service
           └─8327 /home/pi/clublog/clublog-gateway -mode=listener -callsign=ChangeToYourCallSign -password=ChangeThisToYourTopSecretPassword -rate=30

Jan 20 23:48:07 PI4DEC-Domotica systemd[1]: Started clublog.service.
Jan 20 23:48:07 PI4DEC-Domotica clublog-gateway[8327]: G7VJR Club Log real-time upload gateway
Jan 20 23:48:07 PI4DEC-Domotica clublog-gateway[8327]: Version linux/20191203-1023
Jan 20 23:48:07 PI4DEC-Domotica clublog-gateway[8327]: 22:48:07 Initialised new database file
Jan 20 23:48:07 PI4DEC-Domotica clublog-gateway[8327]: 22:48:07 Opened database file:  /home/pi/clublog/ChangeToYourCallSign.db
Jan 20 23:48:07 PI4DEC-Domotica clublog-gateway[8327]: 22:48:07 No QSOs pending (deadtime: 10s)	

All the output will be logged to the system journal (journalctl). The following command shows all the output from our clublog.service.

journalctl -u clublog

You can scroll through the logs with the PageUp and PageDown keys. You get out of the log with the Q-key (Q for Quit)

The following command only shows logs since the last reboot of the system.

journalctl -u clublog -b 0

I hope it works as good for you as it works for me!

73 PA3L

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment