最近发现LINUX下直接使用端口上传文件没有问题,但是用nginx也不可以,即使是把所有的请求都交给tomcat去处理,还是不行 平时在nginx下有一个限制上传大小的,叫max_body_size,如果超过这个值,直接不会转交给tomcat处理…. 一般情况下修改这个是可以的…如果不可以,请查阅nginx日志,看……
判断当前tomcat状态并启动 shell
好吧,今天写一个小shell,高难度的暂时还搞不定
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
#!/bin/bash #检测tomcat状态并做相应的操作,启动tomcat # maple 20121113 TOMCATPATH=/program/tomcat7-3/ #tomcat 路径 TOMCATPORT=8083 #tomcat 端口 cd $TOMCATPATH pIDa=`/usr/sbin/lsof -i :$TOMCATPORT|grep -v "PID" | awk '{print $2}'` if [ "$pIDa" != "" ]; #判断该端口是否被占用 then #如果被占用 /usr/sbin/lsof -i :$TOMCATPORT|grep -v "PID"|awk '{print "kill -9",$2}'|sh&&bin/startup.sh #杀掉端口并重启 else #如果不被占用 bin/startup.sh #直接重启 fi tail -f logs/catalina.out #显示启动日志 |
已经测试过了,可以用,没有清除日志…. 今天最大的收获就是知道了怎么去判断一个命令是否有输出…. 时间:2012-11-13 23:45:22
数据库日志收缩 妈妈再也不用担心我的磁盘空间了…
SHELL脚本判断某端口是否被占用
awk 实例 的shell
好吧,趁着鸡血效果还在,抓紧学习 vi text.txt
1 2 3 4 5 |
F115!16201!1174113017250745 10.86.96.41 211.140.16.1 200703180718 F125!16202!1174113327151715 10.86.96.42 211.140.16.2 200703180728 F235!16203!1174113737250745 10.86.96.43 211.140.16.3 200703180738 F245!16204!1174113847250745 10.86.96.44 211.140.16.4 200703180748 F355!16205!1174115827252725 10.86.96.45 211.140.16.5 200703180758 |
然后第一个命令: awk {print} text.txt 这个就是全部打印了…. 第二个命令: awk ‘/F[12].*/’ {print} 等价于:awk &#……
安全脚本-SSH连接失败最大次数限制(构建高可用LINUX服务器)
LINUX iptables 学习小记
linux调用MSN给好友发信息(URL)
最近领导在做一个网站检测系统,本来发邮件的,今天甩给我一个文档…MSN的,小弟又小白了,非常的简单:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
msnrobotweb(http://code.google.com/p/msnrobotweb/) ================================================ Introduce: msnrobotweb is a msn robot with a small http server embeded. message clients could send messages to buddy with a simple http://localhost:9008/post?msg=[some messages] http request. Requirements: -a msn account signin as the robot ,if not please go to http://get.live.com/ and signup one. -jre/jdk1.5 or high. Install: (the following Linux-based step, Windows is not difficult ): 1 svn checkout http://msnrobotweb.googlecode.com/svn/trunk/msnrobotweb msnrobotweb 2 cd msnrobotweb 3 open start.sh to 3.1 edit username/password , replace with your own. 3.2 change JAVA_HOME path to your own . 4 run ./start.sh to start , your may see something "http server started with port:xxx" then service is done. 5 add buddy which you changed in 3.1 step as your msn friend, and signin your msn. 6 sending a message. open browser with url : http://localhost:9008/post?msg=hello, your msn would receive a message "hello" . every thing is completed. in linux or console,try: curl http://localhost:9008/post?msg=hello Depends: must have jre/jdk1.5 or high version installed. -JML (http://sourceforge.net/projects/java-jml/) , jars are in lib dir. -Simple , an embeddable Java based HTTP engine (http://www.simpleframework.org/) jars are in lib dir. -Common-logging, jars are in dir. you may want to check sources ,please go to see src. code is everything. |
下载地址如下: http://msnrobotweb.googlecode.com/files/msnrobotweb-bin.tar.gz 下载解压 (解压:……
多语言版本根据浏览器版本自动跳转 并记录
现在很多网站是中英文分开的,用文件夹 一个是/zh-cn 和/en-us 这个时候我们在与zh-cn 和 en-us 放一个jsp页面 页面中放入如下代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
<script type="text/javascript"> function GetCookie(sName) { var aCookie = document.cookie.split("; "); for (var i=0; i < aCookie.length; i++) { var aCrumb = aCookie[i].split("="); if (sName == aCrumb[0]) return unescape(aCrumb[1]); } return 0; } var cookieId=GetCookie("zone"); if(cookieId!="t"){ <% String lang = request.getHeader("Accept-Language"); if(lang!=null&&lang.length()>2){ lang = lang.substring(0,2); } if(lang!=null&&lang.equals("en")){ %> window.location.href="http://www.abc.com/en-us/"; <% }else if(lang!=null&&lang.equals("fr")){ %> window.location.href="http://www.abc.com/fr-fr/"; <% }else if(lang!=null&&lang.equals("ar")){ %> window.location.href="http://www.abc.com/ar-ar/"; <% }else if(lang!=null&&lang.equals("pt")){ %> window.location.href="http://www.abc.com/po-po/"; <% }else if(lang!=null&&lang.equals("ru")){ %> window.location.href="http://www.abc.com/be-by/"; <% } %> } </script> |
然后我们要做的就是到英文站点放到cookie中放一个zone=t… 时间你可以写的长一些,然后就可以自……