simple-bpq-telnet-application
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| simple-bpq-telnet-application [2024/11/29 14:56] – kc2ihx | simple-bpq-telnet-application [2026/01/01 22:42] (current) – [BPQ configuration] kc2ihx | ||
|---|---|---|---|
| Line 31: | Line 31: | ||
| < | < | ||
| - | import asyncio, telnetlib3, json | + | import asyncio, telnetlib3, json, sys |
| from optparse import OptionParser | from optparse import OptionParser | ||
| Line 40: | Line 40: | ||
| messages = json.load(open(options.filename,' | messages = json.load(open(options.filename,' | ||
| + | |||
| + | def print_log(*a): | ||
| + | print(*a, file=sys.stderr) | ||
| + | |||
| async def shell(reader, | async def shell(reader, | ||
| incall = await reader.readline() | incall = await reader.readline() | ||
| - | | + | |
| writer.write(" | writer.write(" | ||
| writer.write(" | writer.write(" | ||
| Line 51: | Line 55: | ||
| inp = await reader.read(1) | inp = await reader.read(1) | ||
| while inp and not leave and len(textblocks) > 0: | while inp and not leave and len(textblocks) > 0: | ||
| - | print(" | + | |
| writer.write(textblocks.pop(0)) | writer.write(textblocks.pop(0)) | ||
| await writer.drain() | await writer.drain() | ||
| inp = await reader.readline() | inp = await reader.readline() | ||
| - | if not rolled: | + | if not rolled: |
| - | rolled = True | + | # notify that rolling has happened |
| + | print_log("%s rickrolled" | ||
| + | rolled = True | ||
| leave = inp[0].upper() in [" | leave = inp[0].upper() in [" | ||
| writer.close() | writer.close() | ||
| Line 88: | Line 94: | ||
| In my '' | In my '' | ||
| < | < | ||
| - | CMDPORT=8005 63001 4565 10001 | + | CMDPORT=8005 63001 10001 |
| </ | </ | ||
| - | and in the application list, I added a new entry, where '' | + | and in the application list, I added a new entry, where '' |
| < | < | ||
| - | APPLICATION | + | APPLICATION |
| </ | </ | ||
| Line 98: | Line 104: | ||
| Next we'll configure a '' | Next we'll configure a '' | ||
| - | I created | + | Put this file in ''/ |
| < | < | ||
| # service for RRoAX25 server | # service for RRoAX25 server | ||
| + | # replace USER with the username under which you created the bpq-apps venv | ||
| [Unit] | [Unit] | ||
| Description=" | Description=" | ||
| After=network.target | After=network.target | ||
| + | # this might be backwards, but I do need linbpq for this to work. | ||
| + | Requires=linbpq.service | ||
| [Service] | [Service] | ||
| Type=simple | Type=simple | ||
| - | WorkingDirectory=/ | + | User=evan |
| - | ExecStart=/ | + | Group=evan |
| + | WorkingDirectory=/ | ||
| + | ExecStart=/ | ||
| Restart=always | Restart=always | ||
| + | RestartSec=3 | ||
| [Install] | [Install] | ||
| Line 119: | Line 131: | ||
| Activate it by running: | Activate it by running: | ||
| < | < | ||
| - | systemctl | + | sudo systemctl enable rick.service |
| - | systemctl | + | sudo systemctl start rick.service |
| </ | </ | ||
| Line 126: | Line 138: | ||
| < | < | ||
| - | systemctl | + | systemctl status rick.service |
| </ | </ | ||
| If you need to edit the service file, reload it with: | If you need to edit the service file, reload it with: | ||
| < | < | ||
| - | systemctl | + | systemctl daemon-reload |
| + | </ | ||
| + | |||
| + | Finally, to see who has used it: | ||
| + | < | ||
| + | journalctl -u rick.service -f | ||
| </ | </ | ||
simple-bpq-telnet-application.1732892162.txt.gz · Last modified: by kc2ihx