📄 cgi-bin-mf-status.html.svn-base
字号:
#!/bin/shcat<<EOF<% do_pagehead(); %> <title><% nvram_get("router_name"); %> - Phonebook</title> <script type="text/javascript"><!--document.title = "<% nvram_get("router_name"); %>" + sipath.status_titl;function navarr(){}navset=new navarr();navres=new navarr();function set(idx){ if(!!navset[idx]){ document.images[idx].src=navset[idx].src; }}function res(idx){ if(!!navres[idx]){ document.images[idx].src=navres[idx]; }}function ini() { if (!!document.images){ for(var idx=0; idx<document.images.length; idx++){ var src=document.images[idx].src; var pos=src.indexOf('_white.gif'); if (0<pos) { navres[idx]=src; src=src.substring(0, src.indexOf('_white.gif'))+'_red.gif'; navset[idx]=new Image(document.images[idx].width, document.images[idx].height); navset[idx].src=src; document.images[idx].onmouseover=new Function("if(!!window.set)set("+idx+");"); document.images[idx].onmouseout=new Function("if(!!window.res)res("+idx+");"); } else if (!document.images[idx].mozbug && !!src.search && 0<=src.search(new RegExp('progress[0-9]+\\.gif$'))) { document.images[idx].mozbug=1; document.images[idx].src=''; document.images[idx].src=src; } } }}//--></script></head><body onload="if(null!=window.ini)window.ini()"></script></head> <body class="gui"> <div id="wrapper"> <div id="content"> <div id="header"> <div id="logo"> <h1><% show_control(); %></h1> </div> <% do_menu("Sipath.asp","cgi-bin-mf-status.html"); %> </div> <script type="text/javascript"><!--function help(e) { if (!e) e = event; // (virt)KeyVal is Konqueror, charCode is Moz/Firefox, else MSIE, Netscape, Opera if (26 == e.virtKeyVal || !e.keyVal && !e.charCode && 112 == (e.which || e.keyCode)) { var o = null; if (e.preventDefault) { if (e.cancelable) e.preventDefault(); o = e.target; } else { e.cancelBubble = true; o = e.srcElement; } while(o && '' == o.title) o = o.parentNode; if (o) alert(o.title); }}if (document.all) { document.onkeydown = help; document.onhelp = function(){return false;}}else { document.onkeypress = help;}//--></script>EOFif [ "$REQUEST_METHOD" = "POST" ]; then read QUERY_STRINGfiif [ -n "$QUERY_STRING" ]; then eval $(echo "$QUERY_STRING"|awk -F'&' '{for(i=1;i<=NF;i++){print $i}}')fiif [ -n "$post_reboot" ]; thencat<<EOF <div id="main"> <div id="contents"><h2>Status: Rebooting...</h2> <form action="cgi-bin-mf-status.html" method="post"><table border="1" cellpadding="0" cellspacing="0" class="form"><tbody><tr><td>EOFecho "Your router is now rebooting.<br>If you reload this page another reboot will be initiated!"sh -c "sleep 2;reboot">/dev/null 2>&1 &cat<<EOF</td></tr><tr><td></td></tr><tr><td><input name="post_overview" title="Overview" type="submit" value="Overview" /><input name="post_route" title="Routing Table" type="submit" value="Routing Table" /><input name="post_restart" title="SER Restart" type="submit" value="Restart SER" /><input name="post_reboot" title="Reboot Router" type="submit" value="Reboot Router" /></td></tr></tbody></table></form>EOFelif [ -n "$post_route" ]; thencat<<EOF <div id="main"> <div id="contents"><h2>Status: Routing Table</h2> <form action="cgi-bin-mf-status.html" method="post"><table border="1" cellpadding="0" cellspacing="0" class="form"><tbody><tr><td>EOFroute -n|awk 'function td(s) { printf("<TD ALIGN="left" STYLE=\"padding:0 2 0 2;font-size:9px;\">%s</TD>", s);}function ip(s) {# if(s!~/\.0$/) {# td(sprintf("<A HREF=\"http://%s/\">%s</A>", s, s));# }# else { td(s);# }}BEGIN { print "<TABLE BORDER=\"0\" CELLPADDING=\"3\" CELLSPACING=\"1\">";}/^[0-9]/ { printf "<TR>"; ip($1); ip($2); for(i=3;i<=NF;i++) td($i); printf "</TR>\n";}/^Destination/ { printf "<TR>"; for(i=1;i<=NF;i++) printf("<TH ALIGN=\"left\" STYLE=\"padding:0 2 0 2;\">%s</TH>", $i); printf "</TR>\n";}END { print "</TABLE>";}'cat<<EOF</td></tr><tr><td></td></tr><tr><td><input name="post_overview" title="Overview" type="submit" value="Overview" /><input name="post_route" title="Routing Table" type="submit" value="Routing Table" /><input name="post_restart" title="SER Restart" type="submit" value="Restart SER" /><input name="post_reboot" title="Reboot Router" type="submit" value="Reboot Router" /></td></tr></tbody></table></form>EOFelif [ -n "$post_restart" ]; thencat<<EOF <div id="main"> <div id="contents"><h2>Status: SER Restart</h2> <form action="cgi-bin-mf-status.html" method="post"><table border="1" cellpadding="0" cellspacing="0" class="form"><tbody><!--<tr><th>SSID</th><th>Channel</th><th>Ad Hoc</th><th>Signal</th><th>WEP</th><th>Max.</th><th>BSSID</th></tr><tr>--><td colspan="7">EOFif [ $(nvram get sip_domain) ]; then export SIP_DOMAIN=$(nvram get sip_domain); else export SIP_DOMAIN=$(ifconfig $(nvram get lan_ifname)|awk 'sub("inet addr:","") {print $1}'); fi;serctl restart ser|awk 'sub("", "<br>") {print}'; sleep 3s;cat<<EOF</td></tr><tr><td colspan="7"><input name="post_overview" title="Overview" type="submit" value="Overview" /><input name="post_route" title="Routing Table" type="submit" value="Routing Table" /><input name="post_restart" title="Restart SER" type="submit" value="Restart SER" /><input name="post_reboot" title="Reboot Router" type="submit" value="Reboot Router" /></td></tr></tbody></table></form>EOFelsecat<<EOF <div id="main"> <div id="contents"><h2>Status: Overview</h2> <form action="cgi-bin-mf-status.html" method="post"><table border="1" cellpadding="0" cellspacing="0" class="form" width="548"><tbody> <tr><td>SER Stats:</td><td>$(if [ $(nvram get sip_domain) ]; then export SIP_DOMAIN=$(nvram get sip_domain); else export SIP_DOMAIN=$(ifconfig $(nvram get lan_ifname)|awk 'sub("inet addr:","") {print $1}'); fi; echo "Message type: Occurances"; serctl fifo sl_stats | awk 'sub("", "<br>") {print}';)</td></tr> <!--<tr><td>SER Userlist:</td><td> Address of Record / Contact $(if [ $(nvram get sip_domain) ]; then export SIP_DOMAIN=$(nvram get sip_domain); else export SIP_DOMAIN=$(ifconfig $(nvram get lan_ifname)|awk 'sub("inet addr:","") {print $1}'); fi; serctl ul show| grep "^aor \|^Contact\|^Expires\|^Call-ID\|^User-Agent" | \ sed -e "s/^\(aor \)/======================================\n\1/" | awk 'sub("", "<br>") {print}';)</td></tr>--> <tr><td>SER processes:</td><td>First Receiver Process per IP:Port $(if [ $(nvram get sip_domain) ]; then export SIP_DOMAIN=$(nvram get sip_domain); else export SIP_DOMAIN=$(ifconfig $(nvram get lan_ifname)|awk 'sub("inet addr:","") {print $1}'); fi ; serctl ps| grep child=0\ sock=0 | awk 'sub("", "<br>") {print}'; serctl ps| grep child=0\ sock=1 | awk 'sub("", "<br>") {print}'; serctl ps| grep child=0\ sock=2 | awk 'sub("", "<br>") {print}';)</td></tr> <tr><td>RTPproxy:</td><td> $(ps | grep 'rtpproxy -l' | grep -v 'grep' | cut -f2 -d'l';) <tr><td>lan address:</td><td> $( ifconfig $(nvram get lan_ifname)|awk 'sub("inet addr:","") {print $1}') </td></tr> <tr><td>wan address:</td><td> $(if [ $(nvram get wan_proto) = pppoe ] ; then if [ "`ifconfig | grep ppp0`" ]; then echo $(ifconfig ppp0|awk 'sub("inet addr:","") {print $1}') else echo "ppp0 interface not up" fi else echo $(ifconfig $(nvram get wan_ifname)|awk 'sub("inet addr:","") {print $1}') fi) <tr><td>Device Info:</td><td>Boardtype: $(nvram get boardtype), Boardnum: $(nvram get boardnum)</td></tr> <tr><td>SER Uptime:</td><td>$(if [ $(nvram get sip_domain) ]; then export SIP_DOMAIN=$(nvram get sip_domain); else export SIP_DOMAIN=$(ifconfig $(nvram get lan_ifname)|awk 'sub("inet addr:","") {print $1}'); fi; echo "Please note: Automatic SER restarts may be due to changing network interface addresses"; serctl fifo uptime | awk 'sub("", "<br>") {print}';)</td></tr> <tr><td>Router Uptime:</td><td>$(uptime)</td></tr> <tr><td colspan="2"></td></tr> <tr><td colspan="2"><input name="post_overview" title="Overview" type="submit" value="Reload" /><input name="post_route" title="Routing Table" type="submit" value="Routing Table" /><input name="post_restart" title="SER Restart" type="submit" value="Restart SER" /><input name="post_reboot" title="Reboot Router" type="submit" value="Reboot Router" /></td></tr></tbody></table></form>EOFficat<<EOF </div> </div> <div id="helpContainer"> <div id="help"> <div id="logo"> <h2>Help</h2> </div> <br /> <!--<a href="javascript:openHelpWindow('HManagement.asp')"><% tran("share.more"); %></a>--> </div> </div> <div id="floatKiller"></div> <% do_statusinfo(); %> </div> </div> </body></html>EOF
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -