| Current Path : /var/www/html/ajay/ |
| Current File : //var/www/html/ajay/sendsms.sh |
#http://www.my.host.net.nz/blog/2013/07/quick-script-to-send-smss-under-linux/ #! /bin/bash ############################################################### # Quick script to send an SMS out attached modem # Requires "pppd" is installed for chat command # Usage: $0 phoneno "message in quotes" ############################################################### PHONENO=$1 MESSAGE=$2 MODEM=/dev/ttyUSB0 LOCKFILE=/tmp/smssend.lock if [ "$2." == "." ] then echo "Script to Send an SMS message" echo "Usage: $0 phoneno \"message\"" exit fi if [ -f $LOCKFILE ] then echo "Can't send SMS - SMS program locked. If its not locked please delete $LOCKFILE" else echo $$ > $LOCKFILE /bin/stty 9600 cs8 -parenb -clocal -crtscts -echo -F $MODEM /usr/sbin/chat -E -s TIMEOUT 10 "" "AT&F&C1&D2" "OK" "AT+CMGF=1" "OK" "AT+CMGS=\"$PHONENO\"" "" "$MESSAGE\032" > $MODEM < $MODEM rm $LOCKFILE fi