[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Sending sms from bash
From: |
Eugene Grimsdell |
Subject: |
Re: Sending sms from bash |
Date: |
22 May 2002 14:19:20 +0200 |
Thanx for the help everybody
In true GPL here is the code I use to pop into cron for every hour,
needs some work still but it will do for the next week.
--------------------------
#!/bin/sh
# Variables for editing
PHONE="08XXXXXXX"
SMSC="+2XXXXX"
FILE="/scripts/data/down"
LOG="/var/logs/line"
MACLIST="Cpt PE Blm" # Entries in host file
DATE=`date|cut -c1-19`
echo "---------------" >> $LOG
echo $DATE >> $LOG
echo "---------------" >> $LOG
for M in $MACLIST ; do
ping -c1 $M 2> /dev/null >/dev/null
if [ $? != 0 ]; then
echo $DATE > $FILE
echo $M "is down" >> $FILE
gnokii -sendsms $PHONE --smsc $SMSC < $FILE
else
echo -n $M >> $LOG
echo " is still going" >> $LOG
fi
done
echo "" >> $LOG
-------------------------------------------
Please note that Internet communications are not secure and therefore OSRAM
(Pty) Ltd. does not accept legal responsibility for the contents of this
message. This email is intended only for the use of the individual or entity
named above and may contain information that is confidential and privileged. If
you are not the intended recipient, you are hereby notified that any
dissemination, distribution or copying of this email is strictly prohibited.
Opinions, conclusions and other information in this message that do not relate
to the official business of OSRAM (Pty) Ltd. shall be understood as neither
given nor endorsed by it.
-------------------------------------------