| |
KC9UHI > BPQ 14.09.20 23:20l 98 Lines 2631 Bytes #-2205 (0) @ WW
BID : 41449_N1URO
Read: DJ6UX GUEST
Subj: linBPQ Weekly Traffic Report Automailer Script
Path: DB0FHN<DB0RBS<DB0GOS<DB0EEO<DB0RES<ON0AR<VK6HGR<GB7CIP<N3HYM<W0ARP<
KF5JRV<VA7RBP<VE3UIL<VA3TOK<VE4KLM<I0OJJ<N1URO<N2NOV<K5DAT<PE1RRR<
KC9UHI
Sent: 200830/2344Z 3261@KC9UHI.#ECWI.WI.USA.NOAM LinBPQ6.0.20
>From kc9uhi%kc9uhi.#ecwi.wi.usa.noam@i0ojj.ampr.org Mon Sep 14 23:01:09 2020
Received: from i0ojj.ampr.org by i0ojj.ampr.org (JNOS2.0m.4) with SMTP
id AA129557 ; Mon, 14 Sep 2020 23:01:09 +0200
Message-Id: <41449_N1URO@n1uro.bbs>
>From: kc9uhi@kc9uhi.#ecwi.wi.usa.noam
X-JNOS-User-Port: Circuit (CTJNOS:N1URO-7 N1URO) -> Sending message
>From kc9uhi%kc9uhi.#ecwi.wi.usa.noam@n2nov.ampr.org Sun Aug 30 19:44:00 2020
Received: from n2nov.ampr.org by n2nov.ampr.org (JNOS2.0.6.URO) with SMTP
id AA153300 ; Sun, 30 Aug 2020 19:44:00 EDT
Message-Id: <3261_KC9UHI@k5dat.bbs>
>From: kc9uhi@kc9uhi.#ecwi.wi.usa.noam
X-JNOS-User-Port: Telnet (k5dat @ 50.50.110.146) -> Sending message
I wrote a linux shell script to mail the linBPQ generated weekly traffic report to the local BBS SYSOP. It uses 'expect' to int
eract 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 mornin
g:
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 U
TC Sunday so running Sunday morning local time works well. You may need to adjust the time the mailer script runs (crontab entr
y) 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
-----
Read previous mail | Read next mail
| |