User:Pepsimax2k
From DD-WRT Wiki
Random bash code...
[edit] Telnet to router from router, save output to file, grep file for term
sh /tmp/yourscript | tee /tmp/ipinfo
#!/bin/sh myuser=root mypass=password myhost="192.168.1.2 23" mycmd="uptime" (echo -e "$myuser\r"; sleep 1; echo -e "$mypass\r"; sleep 1; sleep 1; echo -e "$mycmd\r"; sleep 5; ) | telnet $myhost echo -e "exit\r"
if [ "`cat ipinfo | grep "Successful nbr of outgoing calls : [0-2]$"`" = "" ]; then echo "change to voip, set stop_check"; fi;
[edit] Kill chilli if no one connected
#!/bin/sh
KILLCHILLI=0
KILLEND=4
while [ $KILLCHILLI != $KILLEND ]
do
if [ "`/usr/sbin/wl -i wl0.1 assoclist`" = "" ]; then
KILLCHILLI=$KILLEND
/usr/bin/killall chilli
/bin/sleep 5
/usr/sbin/chilli --conf /jffs/chilli.conf
else
KILLCHILLI=`expr $KILLCHILLI + 1`
if [ $KILLCHILLI == $KILLEND ]; then
break
else
sleep 480
fi
fi
done