User:Pepsimax2k
From DD-WRT Wiki
(Difference between revisions)
Revision as of 11:01, 20 October 2007 (edit) Pepsimax2k (Talk | contribs) ← Previous diff |
Revision as of 11:01, 20 October 2007 (edit) (undo) Pepsimax2k (Talk | contribs) (→Kill chilli if no one connected) Next diff → |
||
Line 17: | Line 17: | ||
==Kill chilli if no one connected== | ==Kill chilli if no one connected== | ||
- | #!/bin/sh | + | #!/bin/sh |
- | + | ||
KILLCHILLI=0 | KILLCHILLI=0 | ||
KILLEND=4 | KILLEND=4 |
Revision as of 11:01, 20 October 2007
Random bash code...
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 " 12 days"`" != "" ]; then echo "woohoo"; 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