Beeper script for mgetty
Fabian Hoppe (fabian@vivian.rhein-main.de)
Sun, 22 Oct 1995 21:14:40 +0100
Hi!
Last year, someone (Sorry, but I really don't remember neither his name nor his email
address) sold me a numeric pager and he included a script to automatically call a pager
if a check for new vgetty messages is positiv. Just call this script via crontab as often as
you want.
I just enhanced the script with a BUSY detection which checks the debug.log file
for an incoming "Y" (Which normally doesn't appears in the dialog).
It works fine for quiet a year now.
Enjoy, Fabian
--- snip here-----
#!/bin/sh
export BLOCKSIZE=1024
cd /var/spool/voice/incoming
if [ "`find . -name 'voc*' -newer /var/spool/voice/.cityruf -type f`" ]
then
while [ "`find /var/spool/uucp/ -name 'LCK..ttyS1'`" ]
do
sleep 20
done
zo=`cat ../zone`
wo=`find . -name 'voc*' -newer /var/spool/voice/.cityruf -type f|wc -w|sed 's/[^0-9]//g'`
pp=`du -s|sed 's/[^0-9]//g'`
qq=`ls -s debug.log|awk '{print $1;}'`
sp=`/usr/bin/expr \( $pp - $qq \) / 4`
# sp=`/usr/bin/expr $pp / 4`
echo -e "\nSET LINE /dev/ttyS1\nSET SPEED 2400\nLOG SESSION\nSCRIPT ~0 at OK atz OK at&k0d01691~w40 >~s 2751349"$zo" >~s $wo~055~055~d03$sp~055~055~d04 >~s j\n\n\nquit" >../nachricht
rm -f /var/spool/voice/incoming/debug.log
rm -f /var/spool/voice/incoming/session.log
/usr/local/bin/kermit ../nachricht -d
while [ "`fgrep -e recvseq=89 /var/spool/voice/incoming/debug.log`" ]
do
(echo 'Cityruf: Besetzt, erneuter Versuch...';date) | mail fabian
sleep 60
rm -f /var/spool/voice/incoming/debug.log
/usr/bin/kermit ../nachricht -d
if [ "`fgrep -e failed /var/spool/voice/incoming/session.log`" ]
then
(echo 'Cityruf: Script failed, erneuter Versuch...';date) | mail fabian
fi
done
(echo 'Cityruf: Erfolgreicher Versuch...';date) | mail fabian
rm ../nachricht
fi
touch /var/spool/voice/.cityruf
# rm -f /var/spool/voice/incoming/debug.log
# rm -f /var/spool/voice/incoming/session.log
--
Fabian Hoppe
Habsburger Allee 20 Phone : ++49 69 4970474
60385 Frankfurt Fax : ++49 69 4970474
Germany EMail : fabian@vivian.rhein-main.de
- Mathematicians are devices to convert coffee to theorems -