Hi chaps,
I was wondering if anybody could port a very basic unix script I have written into C or something like that to run on Windows based machines..
It's just a little script that monitors my burglar alarm and phones me if it goes off...
Basically it monitors the signals on a com port of your PC and if it detects any change, it rings you through a modem on the other port.
I take a pair of wires from my 12v alarm output to a relay across the RTS/CTS pins of the com port. When the alarm goes off, the relay closes, loops RTS to CTS which drops CTS to -5v (or is it 3.3v ?).
It uses the statserial program in Linux, I don't know if Windows has anything similar. Statserial gives a numerical value to the summary of the voltage states on all of the pins. It also uses CU to do the dialing.
here's the script..
#!/bin/bash
# Colin Parkes
# 26/10/2000
# Alarmmon 1.1
#
# This script monitors a comm port for any signals sent in (eg. cts, dsr)
# If detected, it dials a pager or mobile phone through the other comm port via a modem and sends 999, when clear it sends 666.
# I use it with a relay across pins 7 & 8 (RTS & CTS). The relay is triggered
# by the 12 volts from my burglar alarm (Most burglar alarms have a 12 volt
# strobe voltage which goes to the external bellbox, when the alarm is
# triggered, this raises.)
# The pager will come up the the numerical message, on the phone you will hear modem tones.
#
# Make sure you have the following UUCP files in place for CU to work..
# For Linux you should find sample scripts.
# cp /usr/doc/uucp-1.06.1/sample/* /etc/uucp/
# /etc/uucp/port : ( device = /dev/ttyS1)
# /etc/uucp/dial : ( check the dial string in case the modem is in quiet mode)
#
alarmdir=/var/log/alarmmon
logfile=alarmlog
pager=01234567890 # Put your pager or mobile number in here.
#
while [ ! -d $alarmdir ]
do
mkdir $alarmdir
chmod 777 $alarmdir
done
while [ -z "`ps -ef | grep -v grep | grep statserial `" ]
do
while [ `statserial -d /dev/ttyS1` -eq 16390 ]
do
sleep 1
done
echo "Alarm" >> $alarmdir/$logfile
date >> $alarmdir/$logfile
cu -p port1 -c $pager,,,999,#
sleep 1
while [ `statserial -d /dev/ttyS1` -ne 16390 ]
do
sleep 1
done
echo "Clear" >> $alarmdir/$logfile
date >> $alarmdir/$logfile
echo "" >> $alarmdir/$logfile
cu -p port1 -c $pager,,,666,#
done
If anybody could do this for me, I will make a $50 donation to Dave's fund.....
I have not intention of trying to sell this or anything. It's just to keep my motorbikes a bit safer and anyone else is welcome to use it.
Here is a link to the original script and a diagram of the wiring.
http://groups.yahoo.com/group/RidesOrgUK/files/ColinP/AlarmFiles/
cheers,
Col
I was wondering if anybody could port a very basic unix script I have written into C or something like that to run on Windows based machines..
It's just a little script that monitors my burglar alarm and phones me if it goes off...
Basically it monitors the signals on a com port of your PC and if it detects any change, it rings you through a modem on the other port.
I take a pair of wires from my 12v alarm output to a relay across the RTS/CTS pins of the com port. When the alarm goes off, the relay closes, loops RTS to CTS which drops CTS to -5v (or is it 3.3v ?).
It uses the statserial program in Linux, I don't know if Windows has anything similar. Statserial gives a numerical value to the summary of the voltage states on all of the pins. It also uses CU to do the dialing.
here's the script..
#!/bin/bash
# Colin Parkes
# 26/10/2000
# Alarmmon 1.1
#
# This script monitors a comm port for any signals sent in (eg. cts, dsr)
# If detected, it dials a pager or mobile phone through the other comm port via a modem and sends 999, when clear it sends 666.
# I use it with a relay across pins 7 & 8 (RTS & CTS). The relay is triggered
# by the 12 volts from my burglar alarm (Most burglar alarms have a 12 volt
# strobe voltage which goes to the external bellbox, when the alarm is
# triggered, this raises.)
# The pager will come up the the numerical message, on the phone you will hear modem tones.
#
# Make sure you have the following UUCP files in place for CU to work..
# For Linux you should find sample scripts.
# cp /usr/doc/uucp-1.06.1/sample/* /etc/uucp/
# /etc/uucp/port : ( device = /dev/ttyS1)
# /etc/uucp/dial : ( check the dial string in case the modem is in quiet mode)
#
alarmdir=/var/log/alarmmon
logfile=alarmlog
pager=01234567890 # Put your pager or mobile number in here.
#
while [ ! -d $alarmdir ]
do
mkdir $alarmdir
chmod 777 $alarmdir
done
while [ -z "`ps -ef | grep -v grep | grep statserial `" ]
do
while [ `statserial -d /dev/ttyS1` -eq 16390 ]
do
sleep 1
done
echo "Alarm" >> $alarmdir/$logfile
date >> $alarmdir/$logfile
cu -p port1 -c $pager,,,999,#
sleep 1
while [ `statserial -d /dev/ttyS1` -ne 16390 ]
do
sleep 1
done
echo "Clear" >> $alarmdir/$logfile
date >> $alarmdir/$logfile
echo "" >> $alarmdir/$logfile
cu -p port1 -c $pager,,,666,#
done
If anybody could do this for me, I will make a $50 donation to Dave's fund.....
I have not intention of trying to sell this or anything. It's just to keep my motorbikes a bit safer and anyone else is welcome to use it.
Here is a link to the original script and a diagram of the wiring.
http://groups.yahoo.com/group/RidesOrgUK/files/ColinP/AlarmFiles/
cheers,
Col