Packet radio is fun and all but if you want to be serious about generating useful bulletins it is rather a chore to type them up. What is required is a way to post an automatically generated bulletin from a text file source. Sounds easy right? It actually is. This is designed around a Linux operating system, and some pre-requisite software is required.
BPQ32, expect, and telnetInstall these packages on your Linux computer like you normally would. In this example I will show how to use any text file that you might generate, and post it as a BBS Bulletin.
Let's start with a text file. It can be any text file, the internet of things and a home automation system allow us to capture data around us and put it in a text file reporting values for a day.
The Telnet access to BPQ32 (or linbpq) in this case must be set up correctly. This will give us command line access to the packet BBS, and therefore the world if we want. The expect command in Linux is clever. It expects some output from stdout and replies with a response on stdin. It will just be like typing the information into the command line yourself, only the .exp script will do it for you. The text file is read in and translated into binary, this is key otherwise the file will not maintain the formatting it originally had. No one likes long lines on a BBS system. Keep it to less than 80 characters across when you generate your text file. Then the expect command can spawn a telnet connection and step through logging into your BBS to send a bulletin. You might want to just verify your login prompts on your own BBS. They may differ, change any text in quotes after the expect command to match your system. Finally the bulletin text can be inserted and the expect script can just log itself out of the telnet connection.
You will notice a \r at the end of some of the commands. This is a carriage return, just like hitting enter on the keyboard. Without it the command won't hit enter and won't go to the next step, so don't forget them.
In your home directory (in this case I'm running this on a Raspberry Pi), so the /home/pi directory I've made a folder called BBSScript. My telnet host actually runs on a non-standard port 8010, so you'll have to change that and any other text in bold to suit your needs. My standard outgoing message file is msgout.txt, and in the example it is being sent to SUBJECT@WW. You can categorize your bulletin however you like. Save the file as sendbulletin.exp and make it executable with a chmod u+x command.
#!/usr/bin/expect
set timeout 20
set msgfile [open "/home/pi/BBSScript/msgout.txt" r]
fconfigure $msgfile -translation binary
set msgout [read $msgfile]
close $msgfile
spawn telnet localhost 8010
expect "user:" { send "MYCALLSIGN\r" }
expect "password:" { send "MYPASSWORD\r" }
expect "MYALIAS:MYCALLSIGN} Nodes" { send "bbs\r" }
expect "BBS>" { send "sb SUBJECT@WW\r" }
expect "Enter Title (only):" { send "BULLETIN SUBJECT\r" }
expect "Enter Message Text (end with /ex or ctrl/z)" { send "$msgout\r" }
expect "EOF" { send "/ex\r" }
expect "BBS (Expert)>" { send "b\r" }
That's the extent of it. It is really that easy. Have another shell script overwrite your msgout.txt file daily, weekly, or any time via a crontab job. Then call this exp script for automatic bulletin generation. You can even call this script from inside your other script.
The last post I made about the weather report on AllStarLink can be modified to gather your weather from the internet and generate the msgout.txt file. Think up your own clever bulletin topic.
The last post I made about the weather report on AllStarLink can be modified to gather your weather from the internet and generate the msgout.txt file. Think up your own clever bulletin topic.
73 and good DX
de N3FIX
No comments:
Post a Comment