User:Pepsimax2k
From DD-WRT Wiki
(Difference between revisions)
Revision as of 10:59, 20 October 2007 (edit) Pepsimax2k (Talk | contribs) (→Telnet to router from router, save output to file, grep file for term) ← Previous diff |
Current revision (18:50, 20 October 2007) (edit) (undo) Pepsimax2k (Talk | contribs) (→Telnet to router from router, save output to file, grep file for term) |
||
(2 intermediate revisions not shown.) | |||
Line 13: | Line 13: | ||
echo -e "exit\r" | echo -e "exit\r" | ||
- | if [ "`cat ipinfo | grep " | + | if [ "`cat ipinfo | grep "Successful nbr of outgoing calls : [0-2]$"`" = "" ]; then echo "change to voip, set stop_check"; fi; |
+ | |||
+ | ==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 |
Current revision
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