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

Leave a comment