John presented a short quiz to mark 30 years of Linux:
Brian demonstrated mqcontrol
, a command line utility to issue MQTT commands. He first installed Go and added
export PATH=$PATH/usr/local/go/bin
to ~/.profile.
After refreshing ~/.profile with
source ~/.profile
he installed mqcontrol
with
go install github.com/albertnis/mqcontrol@latest
and then created mqcontrol.service
which David advised should be placed in /etc/systemd/system/mqcontrol.service
(where it will override all others).
[Unit]
Description=mqcontrol remote control
[Service]
Type=simple
ExecStart=/home/ubuntu/work/goproj/bin/mqcontrol -i mqclinux -c "shutdown -h now" -t jf/close -h 192.168.42.90:1883
[Install]
WantedBy=multi-user.target
…
The IP is the MQTT broker address.
Start and enable the mqcontrol
service
sudo systemctl start mqcontrol
sudo systemctl enable mqcontrol
Arguments used in the mqcontrol
command
--help
-c string Command to run when any message received on topic
-h string Address and port of MQTT broker (default "127.0.0.1:1883")
-i string ID to use for this client
-t string Topic to subscribe to (default "computer/command")
-u string Username for MQTT connection
-p string Password for MQTT connection
See https://github.com/albertnis/mqcontrol/blob/master/README.md.
David noted that you can do simple commands in Home Assistant by editing the config file with yaml; this is documented in Home Assistant.
Brian asked about backing up NextCloud, in particular the associated database; after a long and varied discussion of the implications of backing up a database, depending on the type of database, David suggested that best thing was to wait till nothing was happening and then copy the NextCloud directory. John pointed out that, if the database is mysql/mariadb
, you can use mysqldump
to back the databases up to the NextCloud directory and then back that up.
Brian said that he had wanted to configure Opera Android like Opera Desktop so that it was not rejected by a website; David commented that there are lots of results in Google about changing the user agent in Opera but none of them work and Brian said that he had had no response to his query on the Opera forums. However, we noted this discussion.
There followed an extended discussion between David and Brian on Home Assistant configuration, including how to set up the correct permissions for the device which is monitoring your location on behalf of Home Assistant.
David showed off the servos he had ordered which had arrived but which he could not use because the PCA9685 server board had not and also a 3½" disc drive holding dBASE III!
Darren had found that the OU expectations of the Jupyter notebooks exercise had been higher than he had expected; the programming assignment had been to write a program to recognise images. The next unit looks at convolutional neural networks and whether there are alternatives to using them.
For his final year project he is thinking of developing a command line project.
He mentioned that he had read somewhere that Cobol was supposed to be easy but John explained that that was in comparison with Fortran and assembler. There is now a major project to support Cobol on Linux because so many mainframe based systems still use it and David showed off his Cobol book.
Bernard shared a feature of using Redis (which he had described at the 9 October 2017 meeting) whereby someone can subscribe to a key value in order to receive data so that it becomes a subscription service.
If a publisher writes a log file, for example, to an append only channel, you end up with a continuous stream.
You can also write a program to use the last 20 readings, for example, to create a histogram so that you end up with an average:
# Continuously read a block of 20, print averages of last 20 temperature, humidity. # suitable for an histogram import redis, pprint rconn = redis.Redis(host='localhost', port=6379, db=0) lastid = "0-0" while True: # read a block of 20, waiting 500 msec if no readings present test = rconn.xread({"mystream": lastid}, count=20, block=500) # test is list of lists of tuples, [[ b'mystream', [(id, valuedict),...]],...] streamresult = test[0][1] if not streamresult: # no readings, so continue with the while loop again continue while len(streamresult) <20: # not 20 readings yet, waiting for further readings, read one more lastid = streamresult[-1][0] test = rconn.xread({"mystream": lastid}, count=1, block=500) nextresult = test[0][1] if not nextresult: continue # so another reading taken, add it to streamresult streamresult.extend(nextresult) # streamresult now contains 20 readings, get last id for the next 20 lastid = streamresult[-1][0] average_temperature_in_block = sum(float(item[1][b"temperature"].decode("utf-8")) for item in streamresult) / 20 average_humidity_in_block = sum(float(item[1][b"humidity"].decode("utf-8")) for item in streamresult) / 20 print(round(average_temperature_in_block,2), round(average_humidity_in_block,2))
You can extend this by creating consumer groups which receive unique input, allowing data to be split across different tasks and for another process to take up a task if one fails.
He also mentioned that, when he installed Linux Mint, his Samba share didn't work because the latest version of Samba stops the older version of the protocol from working for security reasons.
So edited /etc/samba/smb.conf
to add the lines:
## added by bernie
client min protocol = NT1
because his BT router uses it.
He noted that Snaps are disabled in Linux Mint for the reasons set out in this blog.
Brian commented that he uses CIFS to do same as Samba with
### //server/Downloads
/home/brian/Downloads cifs credentials=/root/.smbcredentials,iocharset=utf8,file_mode=0777,_netdev,dir_mode=0777 0 0
John shared the page in the Linux Foundation Annual Report showing that Linux kernel support only accounted for 3.4% of expenditure while over 50% went on project support, illustrating the magnitude of the changes over the past 30 years.
David commented that that was 3.4% of a very large turnover.
mysql/mariadb
from the top spot.