systemd-bpq-telnet-application
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| systemd-bpq-telnet-application [2026/02/06 01:11] – created ve3qbz | systemd-bpq-telnet-application [2026/02/06 02:11] (current) – ve3qbz | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | In [[simple-bpq-telnet-application|Creating a simple telnet application for BPQ]] , we describe how to write a simple telnet application that is started by systemd as a daemon, accepts telnet connections to a port, and reads/ | + | In [[simple-bpq-telnet-application|Creating a simple telnet application for BPQ]] , we describe how to write a simple telnet application that is started by systemd as a service, accepts telnet connections to a port, and reads/ |
| - | In this tutorial, we will demonstrate an alternative approach to telnet-enabling a simple terminal based application for access via BPQ that does not require adding network code to the application - we get all of our network I/O for free courtesy of the systemd socket trigger. | + | In this tutorial, we will demonstrate an alternative approach to telnet-enabling a simple terminal based application for access via BPQ that does not require adding network code to the application - we get all of our network I/O for free courtesy of the systemd socket trigger, and our application can simply read and write from standard I/O as if executing at on a normal terminal. |
| - | Our sample application for this tutorial is a WALL command, that allows visitors to the BPQ node to view and leave simple posts on a virtual wall. The application was written by xxxxx and the source code is available here: | + | Our sample application for this tutorial is a WALL command, that allows visitors to the BPQ node to view and leave simple posts on a virtual wall. The application was written by xxxxx and the source code is available here: xxxx link to Daria' |
| - | This is the code for the WALL application: | + | This is the code for our WALL application. Examine this code briefly, and note that all the I/O is simple console input/ |
| + | |||
| + | |||
| + | Save this python file wherever you want it to reside on your filesystem; making sure that it is accessible by whatever account you want it to launch under. | ||
| < | < | ||
| Line 137: | Line 140: | ||
| print(" | print(" | ||
| + | </ | ||
| + | |||
| + | Create a wall.ini configuration file, and save it to the same directory as your python script: | ||
| + | |||
| + | < | ||
| + | # wall.ini | ||
| + | # NodeWall - Graffiti Wall for BPQ Nodes | ||
| + | |||
| + | [wall] | ||
| + | # Welcome banner | ||
| + | banner=--VE3QBZ' | ||
| + | # Message displayed on exit (return to node or disconnect? | ||
| + | exitmsg=Returning to Node. | ||
| + | |||
| + | [posts] | ||
| + | # Posts per page | ||
| + | perpage=10 | ||
| + | # Maximum post length | ||
| + | maxlen=140 | ||
| + | |||
| + | </ | ||
| + | Next, we need to define a systemd service template for the WALL script. | ||
| + | |||
| + | Be sure to customize the path, user, and group that the service will launch as appropriate for your system. | ||
| + | |||
| + | < | ||
| + | [Unit] | ||
| + | Description=LinBPQ Wall Server | ||
| + | |||
| + | [Service] | ||
| + | ExecStart=/ | ||
| + | StandardInput=socket | ||
| + | User=scott | ||
| + | Group=scott | ||
| + | </ | ||
| + | |||
| + | Next, we define a socket trigger for this service template - this is the trigger that will launch the service. | ||
| + | |||
| + | < | ||
| + | [Unit] | ||
| + | Description=LinBPQ Wall | ||
| + | |||
| + | [Socket] | ||
| + | ListenStream=8016 | ||
| + | Accept=yes | ||
| + | |||
| + | [Install] | ||
| + | WantedBy=sockets.target | ||
| + | </ | ||
| + | |||
| + | These two files are placed in / | ||
| + | |||
| + | At this point, we have accomplished the following: | ||
| + | * we have a python script | ||
| + | * we've defined that python script as a systemd service template, allowing multiple instances of the service to be launched concurrently, | ||
| + | * we've defined a systemd socket trigger, that listens on port 8016 for connections. | ||
| + | |||
| + | You can test that this all works by executing telnet localhost 8016 - you should get connected to the service. | ||
| + | |||
| + | |||
| + | TO BE COMPLETED: | ||
| + | explain this more fully. | ||
| + | |||
| + | But for completeness sake, look at application #4 here as a sample of what to place in bpq32.cfg to add the WALL command to your node. Other than setting the application number appropriately (it should increment from the existing ones), all of the other parameters on the line can be left as is for any linbpq setup. | ||
| + | |||
| + | Once you've done this, you can test the WALL application again, but from your BPQ node this time, instead of telneting directly to it. | ||
| + | |||
| + | < | ||
| + | ; | ||
| + | ; ; | ||
| + | ; | ||
| + | ;1 2 | ||
| + | ;#,BPQ CMD,BBS CMD EXE, | ||
| + | APPLICATION 1, | ||
| + | APPLICATION 2, | ||
| + | APPLICATION 3,K2K,ATT 2 192.168.1.2 8015 TELNET, | ||
| + | APPLICATION 4,WALL,C 2 HOST 1 S, | ||
| + | APPLICATION 5,IRC,C 2 HOST 2 S | ||
| </ | </ | ||
systemd-bpq-telnet-application.1770340275.txt.gz · Last modified: by ve3qbz