LinBPQ has a facility to make a tcp connection from the node to an application running on the same machine. This was originally intended to connect to a shell to enable basic configuration editing, but has been generalised to allow connects to other tcp ports, thus allowing you to write your own applications to be used with LinBPQ.
Edit
Henk, pointed out that there was something missing in this story. Nowadays we mainly work with Systemd in the newer version of Linux. So the inetd (internet super server) is no longer part of this. But you can still install it. “sudo apt-get install inetutils-inetd” or the successor to inetd the Xinetd “sudo apt-get install xinetd”
Thank you Henk…
Ok, that sounds nice. Let give it a try.
Fist setup Linbpq, add de “cmdport” to the telnet port section.
PORT
PORTNUM=4 ; Optional but sets port number if stated
ID=Telnet
DRIVER=Telnet
CONFIG
CMS=1
CMSCALL=PI1LAP
CMSPASS=**********
LOGGING=1
DisconnectOnClose=1
CMDPORT 63000
TCPPORT=6309
FBBPORT=6306
HTTPPORT=****
LOGINPROMPT=User:
PASSWORDPROMPT=Password:
MAXSESSIONS=10
CTEXT=Welcome to PI1LAP`s Telnet Server.\nPress ? For list of commands \n\n
USER=pd9q,pass,PD9Q,,SYSOP
ENDPORT
I have add “CMDPORT 63000” but it can by any number.
Now add a Application at the end of de bpq32.cfg
APPLICATION 7,APP,C 4 HOST 0 S
Now we have to add some stuff to /etc/services and /etc/inetd.conf
/etc/services
# Local services
bpqdemo 63000/tcp # BPQ Demo App
/etc/inetd.conf
bpqdemo stream tcp nowait pd9q /usr/local/linbpq/testapp.pl
Now restart inetd. sudo killall -1 inetd
I have found a small script on the internet and make some adjustments.
This script is using some perl modules that has to be installed.
cpanm Linux::SysInfo
cpanm Sys::Info
cpanm Sys::Load
cpanm Sys::MemInfo
cpanm Sys::CpuLoad
The testapp.pl script. /usr/local/linbpq/testapp.pl
#!/usr/bin/perl -w -T
# Simple information script 10/2018. PD9Q/PI1LAP
use strict;
use Sys::Info;
use Sys::Info::Constants qw( :device_cpu );
use Sys::Load qw/getload uptime/;
use Sys::MemInfo qw(totalmem freemem totalswap);
use Sys::CpuLoad;
my $info = Sys::Info->new;
my $cpu = $info->device('CPU');
my $os = $info->os;
my $old_fh = select(STDOUT);
$| = 1;
select($old_fh);
my $line = <STDIN>;
print "Hello " . $line . "Welcome to the LinBPQ System Info App of PI1LAP.\n";
printf "\nWe have %s ", scalar $cpu->count;
printf "%s-bit CPU", scalar $cpu->bitness;
printf " %s\n", scalar $cpu->identify;
printf "The CPU speed is: %s\n\n", scalar $cpu->speed;
print "Operating System is\n", $os->name( long => 1 );
print "\n\nSystem load: ", (getload())[0], "\n";
print "System uptime: ", int uptime(), "\n\n";
print 'load average: ',
join(',', Sys::CpuLoad::load()), "\n\n";
print "Total memory: ".(&totalmem / 1024)."\n";
print "Free memory: ".(&freemem / 1024)."\n";
print "Total swap: ".(&totalswap / 1024)."\n";
print "Free swap: ".(Sys::MemInfo::get("freeswap") / 1024)."\n\n";
print "Type exit to close\n";
while( my $line = <STDIN> )
{
$line =~ s/\r?\n$//;
if ($line =~ /exit/)
{
die "shutting down, bye,bye\n";
}
# do your processing here!
print " $line\n";
}
Now we can run the script from linbpq. Let give it a try.
root@gw:/usr/local/linbpq# telnet localhost 6309
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
User:pd9q
Password:
Welcome to PI1LAP`s Telnet Server.
Press ? For list of commands
app
Connected to APP
Hello PD9Q
Welcome to the LinBPQ System Info App of PI1LAP.
We have 1 32-bit CPU Intel(R) Pentium(R) 4 CPU 3.00GHz
The CPU speed is: 2992.432
Operating System is
Debian Linux 8.10 (kernel: 3.16.0-4-686-pae)
System load: 0.07
System uptime: 1211163
load average: 0.07,0.04,0.00
Total memory: 2062392
Free memory: 440452
Total swap: 2783228
Free swap: 2745472
Type exit to close
exit
shutting down, bye,bye
Returned to Node LAPBPQ:PI1LAP-9
http://www.cantab.net/users/john.wiseman/Documents/LinBPQ%20Applications%20Interface.html