OpenBCM V1.13-36-g8006 (Linux)

Packet Radio Mailbox

DB0FFL

[Box DB0FFL]

 Login: GAST





  
KC9UHI > BPQ      31.08.20 01:50l 59 Lines 1920 Bytes #999 (0) @ WW
BID : 3261_KC9UHI
Read: GAST
Subj: linBPQ Weekly Traffic Report Automailer Script
Path: DB0FFL<DB0FHN<DB0RBS<DB0ERF<DB0RES<ON0AR<OZ5BBS<CX2SA<PE1RRR<KC9UHI
Sent: 200830/2344Z 3261@KC9UHI.#ECWI.WI.USA.NOAM LinBPQ6.0.20

I wrote a linux shell script to mail the linBPQ generated weekly traffic report to the local BBS SYSOP. It uses 'expect' to interact with a BPQ telnet session.

'expect' uses the string '/r' to send a carriage return; the linBPQ traffic report file uses "/r/n" line endings. 'sed' and 'tr' are used to convert the character "/r" to the string '/r' and remove "/n".

Edit the following variables at the top of the script:  BBSUSER:  username to log into BPQ telnet
  BBSPASS:  password for username
  MAILTYPE: type of message to send (same as BBS S command)
  MAILDEST: destination for message
  BPQDIR:   directory where linbpq weekly traffic reports are
  TMPDIR:   writable temporary directory to hold 'expect' script 
My linBPQ installation generates traffic reports on Saturday evenings local time, so I set a crontab entry to run Sunday morning:
0 6 * * 7 /path/to/script/send_traffic_report.sh

The script assumes it is running the same day as the report is generated; the Traffic reports here are generated here at 0000 UTC Sunday so running Sunday morning local time works well. You may need to adjust the time the mailer script runs (crontab entry) to suit your timezone / traffic report generation time.

--
matt
kc9uhi


Traffic report automailer script below
-----
#!/bin/bash

BBSUSER='N0CALL'
BBSPASS='PASSWORD'
MAILTYPE='SP'
MAILDEST='SYSOP@N0CALL.#HA'
BPQDIR='/opt/linbpq'
TMPDIR='/run'

TRAFFICFILE=`date +Traffic_%y%m%d.txt`
TRAFFICDATA=`sed 's/\r/\\r/g' $BPQDIR/$TRAFFICFILE | tr -d '\n'`

cat <<EOT > /run/tmpexpect
spawn telnet 127.0.0.1 8010
expect "user:"
send "$BBSUSER\r"
expect "password:"
send "$BBSPASS\r"
expect "Server"
send "BBS\r"
expect ">"
send "$MAILTYPE $MAILDEST\r"
expect "(only):"
send "$TRAFFICFILE\r"
expect "ctrl/z)"
send "$TRAFFICDATA\r"
send "/EX\r"
expect ">"
send "B\r"
EOT

sed -i 's/\r/\\r/g' $TMPDIR/tmpexpect

expect -f $TMPDIR/tmpexpect
rm -f $TMPDIR/tmpexpect
-----


Lese vorherige Mail | Lese naechste Mail


 06.04.2026 22:12:15lZurueck Nach oben