Radius Manager SMS Script


#!/bin/bash

Username & Password
SQLUSER=”root”
SQLPASS=”sqlpassword”

EXPIRY=”3″

Export Usernames & Mobile from the MySQL
mysql -u$SQLUSER -p$SQLPASS -e “use radius; SELECT username,mobile FROM radius.rm_users  WHERE expiration = DATE_ADD(CURDATE(), INTERVAL $EXPIRY DAY);” > /tmp/list
num=0
cat /tmp/list |sed ‘1d’ |awk ‘NF > 1’ | while read users
do
num=$[$num+1]
username=echo $users |awk ‘{print $1}’
mobile=echo $users | awk ‘{print $2}’

Radius SendSMS Example
curl “http://IP-Address:Port/cgi-bin/sendsms?username=Radius&password=RADIUSPASS&to=$mobile&text=Radius+Your+account+will+expire+after+3+days

done

Cron Job
@daily /temp/sms.sh

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s