Direwolf AX.25 + FEC = FX.25

Probably most of you will already know, Direwolf will support FX.25. This is AX25 with forward error correction. Nice.

The mail John, WB2OSZ posted on the mail list.

What can you do if your radio signal isn’t quite strong enough to get through reliably?  
Move to higher ground?  Get a better antenna?  More power?   
Send data very very slowly with narrow bandwidth?

Sometimes those are not options.  
Another way to improve communication reliability is to add redundant information 
so the message will still get through even if small parts are missing.

FX.25 has been used for more than a decade with some satellites.  
Receiving implementations were oriented toward that niche application.  
Now that FX.25 is easy to use, integrated into a general purpose TNC, 
many other AX.25 based applications can gain the benefits while retaining 
complete compatibility with older equipment.

Read more about it.

Direwolf Kissutil

I was reading on a website and there they talked about kissutil from Direwolf. This appears to be a tool you use interactively for troubleshooting a kiss tnc or you can use it as an application interface. Very nice tool.

kissutil  can be used interactively for troubleshooting a KISS TNC. 
It is usable with direwolf and other generic KISS TNCs connected to a serial port. 
It can also be used as an application interface where each side places files in a directory for the other to process. 

Options
-h host
Hostname or IP address for a TCP KISS TNC.  Default is localhost.

-p port
A number may be specified for a TCP port other than the default 8001. 
If not a number, it is considered to be a serial port name such as /dev/ttyS0 or COM3.

-s speed
Speed for serial port. e.g. 9600.

-o rec-directory
For each received frame, a new file is created here. 
It is expected that some other application will process files in this directory then delete them.

-T format
Each received frame will be preceded by a timestamp in the specified format. 
See strftime documentation for a description of the format string. Example:  %H:%M:%S  for current time in hours, minutes, seconds.

-f xmit-directory
Files in this directory are transmited and deleted. Another application places a file here when it wants something to be transmitted.

-v
Verbose - Display the KISS frames going to and from the TNC.

In the User-guide-1.6-pre you can find somemore info on section 14.6

Write to Jnos UDP port.

I was reading in the release notes of NOSAprs and found something to play with.

Release 1.15b5 (patch)
======================

  • June 24, 2003
  •  DID YOU KNOW – You can send aprs data to NOSaprs using UDP port 16161, and it will go out the APRS rf port. It’s actually been like that for quite some time.

This are two ways to write data to the udp port 16161

#!/bin/bash
exec 3<>/dev/udp/192.168.1.101/16161
echo -e "writing to udp port 16161 Jnos" >&3
exec 3>&-

Sun Dec 22 20:59:52 2019 – ax0 sent:
KISS: Port 0 Data
AX25: PD9Q-10->APZ200 v WIDE1-1 UI pid=Text
0000 …writing to udp port 16161 Jnos…

#!/bin/bash
ver=$(uptime)
echo -n “$ver” | nc -4u -w1 192.168.1.101 16161

Sun Dec 22 20:59:56 2019 – ax0 sent:
KISS: Port 0 Data
AX25: PD9Q-10->APZ200 v WIDE1-1 UI pid=Text
0000 … 20:59:56 up 6:03, 2 users, load average: 0.16, 0.17, 0.17…

Nice let`s think about that

Jnos aprs setup

I running Jnos2.0m with the Aprs server enabled. This is the configuration that I use.

# NOSAPRS
#==================
aprs log /home/pd9q/jnos/aprs/master.log
aprs interface ax0
#
aprs logon call PD9Q-10
#
# I want the APRS Internet System to only send me traffic
# for stations that are within 300 KM, of my location. In my
# case, the city of Winnipeg is roughly 49d54m (Latitude)
# and -97d7m (Longitude).
#
#aprs logon filter r/51.3352/3.4815/50
#
# Configure the Position and Status texts that are broadcast
# out to the APRS Internet System (APRS IS).
#
aprs bc stat "Jnos inet/aprs gateway PD9Q-10"
aprs bc pos "5133.52N/00348.15E & JNOS https://packet-radio.net"
aprs bc timer 720
#
# Configure the Position and Status texts that are broadcast out
# the default APRS RF port (set by the aprs interface command).
#
aprs bc rfstat "Jnos inet/aprs gateway PD9Q-10"
aprs bc rfpos "5133.52N/00348.15E & JNOS https://packet-radio.net"
aprs bc rftimer 10
#
# APRS route add
ax25 route add apz200 ax0 WIDE1-1
ax25 route add id ax0 WIDE1-1
#
# I don't use WX - following for development purposes only
#
aprs wx call PD9Q-13
aprs wx stat "Weather Station - Kortgene JO11VN"
aprs wx pos "5133.52N/00348.15E_METEO packet-radio.nl:14501"
aprs wx data "/home/pd9q/jnos/wx/current.wx"
aprs bc rftimer 10
#
# Heard table
#
aprs hsize 10
#
# Turn on digi
#
aprs flags +digi +debug
#
# Stuff for the 14501 status page
#
aprs contact m "pd9q@packet-radio.net"
aprs locator "JO11VN"
#
# Connection to APRS internet system
#
aprs server add pa4tw.nl 10152
#
# Potential APRS Clients
#
#aprs client add 44.135.124.62 14825
#
# IF you want to gate traffic to RF - BE VERY CAREFULL
# with these filters. You don't want to FLOOD your local
# frequencies with solid traffic. You've been warned !!
#
#aprs calls fwdtorf VE4 VA4 VE3JJ VE3HDU
#aprs calls postorf VE4 VA4 VE3JJ VE3HDU
#aprs calls stattorf VE4 VA4 VE3JJ VE3HDU
#aprs calls wxtorf VE4 VA4 S VE3JJ VE3HDU
#
# This next entry gives specific IP address(s) permission to use the
# browser based APRS message center to it's full capacity. By default,
# the message center allows READ-ONLY access (ie, you can't send).
#
aprs calls ip45845 192.168.1.186
#
aprs email local
#
# Activate the core NOSaprs service
#
aprs listen on
#
# If you want the NOSaprs status page to be available,
# for example, 'http://localhost:14501'.
#
start aprs 14501
#
# If you want the NOSaprs browser based message center
# for example, 'http://localhost:14845'.
#
start aprs 45845

 

 

Weather beacon

I wanted to broadcast a weather beacon, but since I don’t have a weather station it became a bit more difficult. After some searching on the internet I came across a site where I can download a file with an api with weather data that is no more than 10 minutes old. Great. After downloading the file looks a little messy.

 "liveweer": [{"plaats": "Kortgene", "station": "DE BILT AWS", "timestamp": "1577030283", "time": "22-12-2019 16:58:03", "temp": "7.3", "gtemp": "4.6", "samenv": "Van tijd tot tijd lichte regenbuien of regen", "image": "regen", "windrgr": "182.7", "windr": "ZZO", "windms": "4.06", "windbft": "3", "windknp": "7.9", "windkmh": "14.6", "windstootms": "5.19", "windstootbft": "3", "windstootknp": "10.1", "windstootkmh": "18.7", "luchttemp": "7.2", "lv": "99", "luchtd"

I can’t do much with this. Let`s manupilate the file. First add some “enters”/”new lines” in the file.

Add a enter after/new line “, ”
sed -i $’s/”, “/),\\\n(/g’ ~/wx-project/meteo.wx

Now the file looks like this

{ "liveweer": [{"plaats": "Kortgene),
(station": "DE BILT AWS),
(timestamp": "1577030283),
(time": "22-12-2019 16:58:03),
(temp": "7.3),
(gtemp": "4.6),
(samenv": "Van tijd tot tijd lichte regenbuien of regen),
(image": "regen),
(windrgr": "182.7),
(windr": "ZZO),
(windms": "4.06),
(windbft": "3),
(windknp": "7.9),
(windkmh": "14.6),
(windstootms": "5.19),
(windstootbft": "3),
(windstootknp": "10.1),
(windstootkmh": "18.7),
(luchttemp": "7.2),
(lv": "99),
(luchtd": "_),

That’s better, just clean up the mess. I end up with this.

# Remove the non-letters/numbers except . and : and –
sed -i -e “s/[^ 0-9a-zA-Z.:-]//g” -e ‘s/ \+/ /’ ~/wx-project/meteo.wx

liveweer: plaats: Kortgene
station: DE BILT AWS
timestamp: 1577030283
time: 22-12-2019 16:58:03
temp: 7.3
gtemp: 4.6
samenv: Van tijd tot tijd lichte regenbuien of regen
image: regen
windrgr: 182.7
windr: ZZO
windms: 4.06
windbft: 3
windknp: 7.9
windkmh: 14.6
windstootms: 5.19
windstootbft: 3
windstootknp: 10.1
windstootkmh: 18.7
luchttemp: 7.2
lv: 99

Now we can read the line and get the value from it. I do this with “awk”

temp=$(awk ‘NR==5{print $2}’ meteo.wx)
echo TEMP=”$temp”°C Temperature degrees Celsius

Read line 5 word number two. And we have…………….

7.3°C Temperature degrees Celsius.

In the Netherlands we work with the mertrice system. Now the weather beacon is displayed in the imperial system. Now some calculation work must take place.

# Do some calulation
# From °Celsius to Fahrenheit
fah=$(echo "(($temp*1.8)+32)" | bc)
fah1=$(echo "$fah" | awk -F'.' '{print $1}')
fah2=$(echo $fah1 | sed -e :a -e 's/^.\{1,2\}$/0&/;ta')
echo FAH="$fah2"F Temperature degrees Fahrenheit
# (Wind speed miles)From kilometer per hour to miles per hour and add leading zero(s)
wpm=$(echo "$wpk"/1.609344 | bc)
wpm0=$(echo $wpm | sed -e :a -e 's/^.\{1,2\}$/0&/;ta')
echo WPM="$wpm0"mph Wind speed in miles per hour
# (Wind guts miles) From kilometer per hour to miles per hour and add leading zero(s)
wgm=$(echo "$wgk"/1.609344 | bc)
wgm0=$(echo $wgm | sed -e :a -e 's/^.\{1,2\}$/0&/;ta')
echo WGM="$wgm0"mph Wind guts in miles per hour
# (Rain in inches) From mm to inches the last hour. Remove the (DOT) and only the first 3 numbers
rni=$(echo "$rn"*0.0039370 | bc)
rni0=$(echo $rni | sed -e 's/^[.]*//g' -e 's/^\(.\{3\}\).*$/\1/')
echo RNI="$rni0"inch Rain in the last hour in inches
# (Rain (24) in inches) From mm to inches the last 24 hour. Remove the (DOT) and only the first 3 numbers
rni24=$(echo "$rn24"*0.0039370 | bc)
rni240=$(echo $rni24 | sed -e 's/^[.]*//g' -e 's/^\(.\{3\}\).*$/\1/')
echo RNI="$rni240"inch Rain in the last 24 hour in inches
# (Rain (12) in inches) From mm to inches the last 12 hour. Remove the (DOT) and only the first 3 numbers
rni12=$(echo "$rn12"*0.0039370 | bc)
rni120=$(echo $rni12 | sed -e 's/^[.]*//g' -e 's/^\(.\{3\}\).*$/\1/')
echo RNI="$rni120"inch Rain in the last 12 hour in inches

We can finally put the beacon together.

# Let show what we have and put it on the place it belong.
echo !5133.52N/00348.15E_"$grd"/"$wpm0"g"$wgm0"t"$fah2"r"$rni0"p"$rni240"P"$rni120"h"$hum"b"$bar"
echo !5133.52N/00348.15E_"$grd"/"$wpm0"g"$wgm0"t"$fah2"r"$rni0"p"$rni240"P"$rni120"h"$hum"b"$bar" > /home/pd9q/jnos/wx/current.wx

Output

!5133.52N/00348.15E_272/010g022t046r005p028P017h92b0987

The compleet output looks like this.

TEMP=8°C Temperature degrees Celsius
WPK=16.8km/h Wind speed in Kilometers per hour
WGK=35.6km/h Wind guts in Kilometers per hour
GRD=272° Wind direction in degrees
RAIN=1.48067mm Rain in the last hour in mm
RAIN24=7.23632mm Rain in the last 24 hour in mm
RAIN12=4.53765mm Rain in the last 12 hour in mm
HUM=92% Humidity in procent
Bar=0987mb Barometric pressure in millibars
FAH=046F Temperature degrees Fahrenheit
WPM=010mph Wind speed in miles per hour
WGM=022mph Wind guts in miles per hour
RNI=005inch Rain in the last hour in inches
RNI=028inch Rain in the last 24 hour in inches
RNI=017inch Rain in the last 12 hour in inches
!5133.52N/00348.15E_272/010g022t046r005p028P017h92b098

The complete script look like this.

I put it in a cronjob, now it’s running every 15 minutes.
crontab -e
*/15 * * * * /home/pd9q/wx-project/get-wx.sh >/dev/null 2>&1

!/bin/bash
# Date 22-12-2019... Dammmmm what a job :)
# The weather beacon have to look like this....
# @220424z5057.81N/00729.37E_094/002g005t043r000p006P006h89b09783
# !5133.52N/00348.15E_073/013g...t048h85b10040wWXD
#
# Jun 01 2003 08:07
# 272/000g006t069r010p030P020h61b10150
# ***********************************************************
# 272 - wind direction - 272 degrees
# 010 - wind speed - 10 mph
# g015 - wind gust - 15 mph
# t069 - temperature - 69 degrees F
# r010 - rain in last hour in hundredths of an inch - 0.1 inches
# p030 - rain in last 24 hours in hundredths of an inch - 0.3 inches
# P020 - rain since midnight in hundredths of an inch - 0.2 inches
# h61 - humidity 61% (00 = 100%)
# b10153 - barometric pressure in tenths of a MILLIBAR - 1015.3 MILLIBARS
#
# Get the wx data from Weerlive/Meteoserver
#wget -O - "http://weerlive.nl/api/json-data-10min.php?key=?!?!?!?!?!&locatie=Kortgene" > ~/wx-project/weerlive.wx
#
wget -O - "https://data.meteoserver.nl/api/liveweer_synop.php?locatie=Kortgene&key=!?!?!?!?!?!?&select=1" > ~/wx-project/meteo.wx
#
# Some file manipulation on the METEO.WX file
# Add a enter after ", "
sed -i $'s/", "/),\\\n(/g' ~/wx-project/meteo.wx
# Remove the non-letters/numbers except . and : and -
sed -i -e "s/[^ 0-9a-zA-Z.:-]//g" -e 's/ \+/ /' ~/wx-project/meteo.wx
#
# Getting the data sorted....
now=$(date +%d%H%M)
#
temp=$(awk 'NR==5{print $2}' meteo.wx)
echo TEMP="$temp"°C Temperature degrees Celsius
# Wind speed (Kilometers)
wpk=$(awk 'NR==14{print $2}' meteo.wx)
echo WPK="$wpk"km/h Wind speed in Kilometers per hour
# Wind gust (Kilometers)
wgk=$(awk 'NR==18{print $2}' meteo.wx)
echo WGK="$wgk"km/h Wind guts in Kilometers per hour
grd=$(awk 'NR==9{print $2}' meteo.wx | awk -F'.' '{print $1}')
echo GRD="$grd"° Wind direction in degrees
rn=$(awk 'NR==38{print $2}' meteo.wx)
echo RAIN="$rn"mm Rain in the last hour in mm
rn24=$(awk 'NR==39{print $2}' meteo.wx)
echo RAIN24="$rn24"mm Rain in the last 24 hour in mm
rn12=$(awk 'NR==37{print $2}' meteo.wx)
echo RAIN12="$rn12"mm Rain in the last 12 hour in mm
hum=$(awk 'NR==20{print $2}' meteo.wx)
echo HUM="$hum"% Humidity in procent
bar=$(awk 'NR==21{print $2}' meteo.wx | awk -F: '{ printf "%04i", $1,$2 }')
echo Bar="$bar"mb Barometric pressure in millibars

# Do some calulation
# From °Celsius to Fahrenheit
fah=$(echo "(($temp*1.8)+32)" | bc)
fah1=$(echo "$fah" | awk -F'.' '{print $1}')
fah2=$(echo $fah1 | sed -e :a -e 's/^.\{1,2\}$/0&/;ta')
echo FAH="$fah2"F Temperature degrees Fahrenheit
# (Wind speed miles)From kilometer per hour to miles per hour and add leading zero(s)
wpm=$(echo "$wpk"/1.609344 | bc)
wpm0=$(echo $wpm | sed -e :a -e 's/^.\{1,2\}$/0&/;ta')
echo WPM="$wpm0"mph Wind speed in miles per hour
# (Wind guts miles) From kilometer per hour to miles per hour and add leading zero(s)
wgm=$(echo "$wgk"/1.609344 | bc)
wgm0=$(echo $wgm | sed -e :a -e 's/^.\{1,2\}$/0&/;ta')
echo WGM="$wgm0"mph Wind guts in miles per hour
# (Rain in inches) From mm to inches the last hour. Remove the (DOT) and only the first 3 numbers
rni=$(echo "$rn"*0.0039370 | bc)
rni0=$(echo $rni | sed -e 's/^[.]*//g' -e 's/^\(.\{3\}\).*$/\1/')
echo RNI="$rni0"inch Rain in the last hour in inches
# (Rain (24) in inches) From mm to inches the last 24 hour. Remove the (DOT) and only the first 3 numbers
rni24=$(echo "$rn24"*0.0039370 | bc)
rni240=$(echo $rni24 | sed -e 's/^[.]*//g' -e 's/^\(.\{3\}\).*$/\1/')
echo RNI="$rni240"inch Rain in the last 24 hour in inches
# (Rain (12) in inches) From mm to inches the last 12 hour. Remove the (DOT) and only the first 3 numbers
rni12=$(echo "$rn12"*0.0039370 | bc)
rni120=$(echo $rni12 | sed -e 's/^[.]*//g' -e 's/^\(.\{3\}\).*$/\1/')
echo RNI="$rni120"inch Rain in the last 12 hour in inches

#@220424z5057.81N/00729.37E_094/002g005t043r000p006P006h89b09783
# Let show what we have and put it on place it belong.
echo !5133.52N/00348.15E_"$grd"/"$wpm0"g"$wgm0"t"$fah2"r"$rni0"p"$rni240"P"$rni120"h"$hum"b"$bar"
echo !5133.52N/00348.15E_"$grd"/"$wpm0"g"$wgm0"t"$fah2"r"$rni0"p"$rni240"P"$rni120"h"$hum"b"$bar" > /home/pd9q/jnos/wx/current.wx
#

 

Jnos 2.0m run as NON-Root user

From version 2.0m it is possible to run Jnos as a NON-Root user.

The changelog from the website of Maiko.

a) create a new JNOS user and group

       jnos:x:1001:1001::/home/jnos:/bin/bash
       jnos:x:1001:

  b) change ownership of the entire JNOS runtime area

       chown -R jnos:jnos /jnos/rte

  c) as root user, configure a tunN interface, and just leave it there forever.

       ip tuntap add mode tun dev tun4

       ifconfig tun4 192.168.200.200 pointopoint 192.168.200.201 mtu 1500 up

     WARNING : make sure you pick a number N that does not conflict with any
               other tun interfaces that might be running - OpenVPN comes to
               mind for example, some VM subsystems might use tun as well ?

   d) modify autoexec.nos, add an extra parameter to the 'attach tun' entry,
      and make sure to comment out the point to point ifconfig.

      So what was previously run as root, for example, below :

       attach tun tun0 1500 0

       shell ifconfig tun0 192.168.200.200 pointopoint 192.168.200.201 mtu 1500 up

      will now just become a one line entry, below :

       attach tun tun0 1500 0 tun4

I have add some of the stuff in my /etc/rc.local file.

# Jnos
sysctl -w net.ipv4.ip_forward=1
ip tuntap add mode tun dev tun4
ifconfig tun4 192.168.1.100 pointopoint 192.168.1.101 mtu 1500 up

# Put a "Proxy ARP" on the Linux Ethernet so that it can answer any
# querries for the JNOS addres
/usr/sbin/arp -i eth0 -Ds 192.168.1.101 eth0 pub

This is what i have in the autoexec.nos

attach tun tun0 1500 0 tun4
#
ifconfig tun0 ipaddress 192.168.1.101
ifconfig tun0 netmask 0xfffffffc
ifconfig tun0 mtu 1500

Now you can run Jnos as a “normal” user.

Brian Kantor, WB6CYT, SK

Very,very sad news…..

Below a mail from Phil Karn.

[44net] Brian Kantor, WB6CYT, SK
Date:       Fri, 22 Nov 2019 15:27:49 -0800 (11/22/2019 06:27:49 PM)

I have very sad news. My good friend, Brian Kantor, WB6CYT ,suddenly passed away this week at his home in San Diego, California.

Brian retired only two years ago after 47 years of service on the staff at the University of California San Diego (UCSD). Way back in the mid 1980s, Brian and I founded AMPRnet, the TCP/IP over amateur radio network. He continued to manage it until his passing.

Brian recently created and served as chair and CEO of Amateur Radio Digital Communications (ARDC), a charitable foundation funded by the sale of unused AMPRnet IPv4 addresses.  ARDC promotes STEM education and amateur radio digital development through scholarships and by funding the development of open source hardware and software.

Brian will be sorely missed and impossible to replace. Memorial arrangements will be announced when known.

Phil Karn, KA9Q

Update Linbpq with up2bpq

Ok, first of all I want to apologize for my fantastic bash scripting arts. There must be people laughing there ass off.

I was searching the internet for an update program or script for Linbpq. I could not find these, so I started using my bash scripting skills.

Maybe someone has better ideas.

The problem is that John GM8BPQ does not work with version numbers in his program names. This makes it difficult to quickly see if you need to update. Now I always look at the dates, this gave me an idea.

Why not look at the Last_Modified date with a shell script. Now of course you first have to check on your own system which date you have with your most recent Linbpq program file.

pd9q@packet:~ $ date -d "$( stat /home/pd9q/linbpq/linbpq | awk '/Modify/{gsub( /^[^:]+: +/,"",$0); print}' )"   "+%Y-%m-%d"
2019-09-26

Okay now we have to take a look at John’s date on his web server.

pd9q@packet:~ $ date -d "$( curl -sI http://www.cantab.net/users/john.wiseman/Downloads/Beta/pilinbpq  | awk '/Last-Modified/{gsub( /^[^:]+: +/,"",$0); print}' )"   "+%Y-%m-%d"
2019-10-05

Now you have two dates, lets compare.

local=$(date -d "$( stat /home/pd9q/linbpq/check/linbpq | awk '/Modify/{gsub( /^[^:]+: +/,"",$0); print}' )"   "+%Y-%m-%d")
remote=$(date -d "$( curl -sI http://www.cantab.net/users/john.wiseman/Downloads/Beta/pilinbpq  | awk '/Last-Modified/{gsub( /^[^:]+: +/,"",$0); print}' )"   "+%Y-%m-%d")
    # Compare the Modified date`s
if (( ${local//-/} < ${remote//-/} ));
then

It should be  “if (( ${local//-/} < ${remote//-/} ));”

The local file is from 2019-09-26 and de remote file is from 2019-10-05
Let get the new Linbpq version from 2019-10-05 and downloading it with a timestamp. I want the timestamp to remain the same, otherwise nothing later can be compared.

wget -N http://www.cantab.net/users/john.wiseman/Downloads/Beta/pilinbpq -P /home/pd9q/linbpq

The -N oprions by the wget command stands for –Timestammping

Now I want to name the file linbpq with the date of the download and copy it to the directory /home/pd9q/linbpq. If you use the -p option with cp the timestamp stays the same. And I also have the file in the /home/pd9q/linbpq/check directory. This is because I need it to compare the dates.

now=$(date "+%Y-%m-%d")
    cp -p /home/pd9q/linbpq/pilinbpq /home/pd9q/linbpq/linbpq-$now
    yes | cp -rfp /home/pd9q/linbpq/pilinbpq /home/pd9q/linbpq/check/linbpq

Let`s remove pilinbpq, we no longer need him. And chmod the linbpq file so we can execute it.

rm -f /home/pd9q/linbpq/pilinbpq
chmod +x /home/pd9q/linbpq/linbpq-$now

I’m using the sed command to alter the linbpq start file.

sed -i "s,sudo -u pd9q ./.*$,sudo -u pd9q ./linbpq-"$now"," /home/pd9q/linbpq/linbpq.start
pd9q@packet:~ $  grep linbpq-  /home/pd9q/linbpq/linbpq.start
sudo -u pd9q ./linbpq-2019-10-31

That works very well.

Now let’s restart Linbpq with the new version of Linbpq

sudo systemctl restart linbpq

If you now run up2bpq again you will get the following message if the two dates match.

pd9q@packet:~ $ ./up2bpq
Your version has the same timestamp so your version is up2date
The local linbpq in the /home/pd9q/linbpq/check directory has 2019-10-05 as timestamp.
The remote pilinbpq has 2019-10-05 as timestamp.

Here is the entire script.

#!/bin/bash
#
# Fist make a directory called check in your linbpq directory and made a copy of the linbpq program file to it.
#
    # Lets get the Modify date from linbpq local en pilinbpq remote
local=$(date -d "$( stat /home/pd9q/linbpq/check/linbpq | awk '/Modify/{gsub( /^[^:]+: +/,"",$0); print}' )"   "+%Y-%m-%d")
remote=$(date -d "$( curl -sI http://www.cantab.net/users/john.wiseman/Downloads/Beta/pilinbpq  | awk '/Last-Modified/{gsub( /^[^:]+: +/,"",$0); print}' )"   "+%Y-%m-%d")
    # Compare the Modified date`s
if (( ${local//-/} < ${remote//-/} ));
then
    #
    echo The local file is from $local and de remote file is from $remote
    echo Let get the new Linbpq version from $remote and downloading it with a timestamp.
    #
    wget -N http://www.cantab.net/users/john.wiseman/Downloads/Beta/pilinbpq -P /home/pd9q/linbpq
    #
    echo Let give the file a date.
    echo We are going to copy the file with the same Last_Modified as on the webserver of GM8BPQ.
    echo And we give it the timestamp of downloading. Dont forget to copy it with the -p option.
    #
    now=$(date "+%Y-%m-%d")
    cp -p /home/pd9q/linbpq/pilinbpq /home/pd9q/linbpq/linbpq-$now
    yes | cp -rfp /home/pd9q/linbpq/pilinbpq /home/pd9q/linbpq/check/linbpq
    # Remove pilinbpq
    rm -f /home/pd9q/linbpq/pilinbpq
    chmod +x /home/pd9q/linbpq/linbpq-$now
    # We are going to use the sed command to alter the linbpq start file.
    sed -i "s,sudo -u pd9q ./.*$,sudo -u pd9q ./linbpq-"$now"," /home/pd9q/linbpq/linbpq.start
    echo Lets check "if" its was okay.
    #
    grep linbpq-  /home/pd9q/linbpq/linbpq.start
    #
    echo Now lets start Linbpq with the new version.
    #
    sudo systemctl restart linbpq
else
    echo "Your version has the same timestamp so your version is up2date"
    echo The local linbpq in the /home/pd9q/linbpq/check directory has $local as timestamp.
    echo The remote pilinbpq has $remote as timestamp
fi

Systemd and Linfbb

I had some problems starting Linfbb with systemd. The problem turned out to be that Linfbb was running in the background. Systemd was thinking fbb was going offline and kept restarting. Now it is possible to provide start options with fbb.

Command line options of the fbb script :
—————————————-
-f : Software is run in foreground
-h : help information
-q : run silent
-l logfile : log debug info to logfile

Now I put the following in my fbb start file.

pd9q@packet:~/linbpq $ cat fbb.start
# Start Linfbb file
sudo /usr/local/sbin/fbb -f -l /home/pd9q/linbpq/fbb.log

The unit file for systemd.

pd9q@packet:~/linbpq $ cat /etc/systemd/system/fbb.service
[Unit]
Description=LinFbb Daemon
After=network.target
After=linbpq.target
After=direwolf.target
StartLimitInterval=0

[Service]
Type=simple
Restart=always
RestartSec=5
ExecStartPost=/bin/sh -c "echo $MAINPID > /home/pd9q/linbpq/run/fbb.pid"
ExecStart=/bin/sh /home/pd9q/linbpq/fbb.start

[Install]
WantedBy=multi-user.target
Alias=fbb.service

Systemctl status fbb

pd9q@packet:~/linbpq $ sudo systemctl status fbb
● fbb.service - LinFbb Daemon
   Loaded: loaded (/etc/systemd/system/fbb.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2019-10-27 06:04:57 UTC; 24min ago
  Process: 536 ExecStartPost=/bin/sh -c echo $MAINPID > /home/pd9q/linbpq/run/fbb.pid (code=exited, status=0/SUCCESS)
 Main PID: 535 (sh)
    Tasks: 4 (limit: 4915)
   CGroup: /system.slice/fbb.service
           ├─535 /bin/sh /home/pd9q/linbpq/fbb.start
           ├─541 sudo /usr/local/sbin/fbb -f -l /home/pd9q/linbpq/fbb.log
           ├─584 /bin/bash /usr/local/sbin/fbb -f -l /home/pd9q/linbpq/fbb.log
           └─826 /usr/local/sbin/xfbbd -a

Oct 27 06:05:02 packet sh[535]: 1 records updated
Oct 27 06:05:02 packet sh[535]: Files set-up complete
Oct 27 06:05:02 packet sh[535]: FORWARD set-up
Oct 27 06:05:02 packet sh[535]: BBS set-up
Oct 27 06:05:02 packet sh[535]: Set-up complete
Oct 27 06:05:02 packet sh[535]: GMT 06:05 - LOCAL 06:05
Oct 27 06:05:02 packet sh[535]: Starting multitasking ... ok
Oct 27 06:05:02 packet sh[535]: FBB options : -a
Oct 27 06:05:02 packet sh[535]: Running XFBB in foreground mode ^C to abort
Oct 27 06:05:07 packet sh[535]: Starting XFBB (pwd = /usr/local/var/ax25/fbb)...

Now is fbb running just fine.