• 批量设置Linux器的服务

    在centos6上安装后有很多不需要的服务,可以通过for循环批量的禁用

    for SERVICES in abrtd acpid auditd avahi-daemon cpuspeed haldaemon ip6tables mdmonitor messagebus udev-post; do chkconfig ${SERVICES} off; done

  • mysql mha

    mysql mha

    [Read More…]

  • centos 5禁用ip6

    centos 5禁用ip6

    [Read More…]

  • iptables + Denyhost抵御暴力破解

    1、使用iptables 现在每分钟连接ssh的次数

    允许本地环回接口访问
    iptables -A INPUT -i lo -j ACCEPT

    对已经建立的所有链接都放行
    iptables -A INPUT -m state –state ESTABLISHED -j ACCEPT

    每分钟对ssh的新连接只允许两个,已建立的连接不限制
    iptables -A INPUT -p tcp –dport 22 -m limit –limit 2/minute –limit-burst 2 -m state –state NEW -j ACCEPT

    添加默认策略拒绝所有
    iptables -P INPUT DROP

    [Read More…]

  • lnmp部署discuz

    通过discuz测试自己搭建的lnmp环境

    [Read More…]

  • CentOS 6 最小化安装找不到setup工具方法

    在安装CentOS 6时由于安装时不想安装图形界面,所以选择了最小化安装,安装后,连最基本的setup命令都找不到,因为没有安装 setuptool的原因,解决办法:yum install setuptool来解决,可实际上这样根本解决不了问题,原因很简单:最小化安装时网卡都没有给你配置,网都上不了根本没办法采用这个方法; 解决方法其实也很简单:通过cdrom安装盘来安装软件!

    [Read More…]

  • windows下tomcat添加到服务

    1、检测系统是否已经安装了tomcat并设置了catalian等环境变量,如果安装了其他版本的tomcat并设置了catalina_home或者catalina_bas等环境变量要使用unset命令先清空这些变量。

    2、打开命令提示符,进入到tomcat的bin目录下

    3、执行service.bat将tomcat转载到系统服务

          service.bat install  服务名
           如果不指定服务名会默认装载成 tomcat

    4、卸载tomcat服务

          service.bat remove 服务名
          或者使用系统自带的sc命令
          sc delete 服务名

  • bat 获取昨天日期

     

    @echo off
    setlocal EnableDelayedExpansion
     
    echo Generate last datetime...
    set TodayYear=%date:~0,4%
    set TodayMon=%date:~5,2%
    set TodayDay=%date:~8,2%
    if "!TodayDay!" == "08" set TodayDay=8
    if "!TodayDay!" == "09" set TodayDay=9
     
    set LastdayYear=
    set LastdayMon=
    set LastdayDay=
     
    set LastdayYear=%TodayYear%
    set LastdayMon=%TodayMon%
    set /A LastdayDay=TodayDay-1
     
    echo %TodayDay%
    echo %LastdayDay%
     
     
    if "%LastdayDay%" == "0" (
      if "!LastdayMon!" == "01" (
      set LastdayMon=12
      set /A LastdayYear-=1
      ) else (
      set /A LastdayMon-=1
     
      if "!LastdayMon!" == "1" set LastdayMon=01
      if "!LastdayMon!" == "2" set LastdayMon=02
      if "!LastdayMon!" == "3" set LastdayMon=03
      if "!LastdayMon!" == "4" set LastdayMon=04
      if "!LastdayMon!" == "5" set LastdayMon=05
      if "!LastdayMon!" == "6" set LastdayMon=06
      if "!LastdayMon!" == "7" set LastdayMon=07
      if "!LastdayMon!" == "8" set LastdayMon=08
      if "!LastdayMon!" == "9" set LastdayMon=09
      )
     
      if "!LastdayMon!" == "01" set LastdayDay=31
      if "!LastdayMon!" == "03" set LastdayDay=31
      if "!LastdayMon!" == "04" set LastdayDay=30
      if "!LastdayMon!" == "05" set LastdayDay=31
      if "!LastdayMon!" == "06" set LastdayDay=30
      if "!LastdayMon!" == "07" set LastdayDay=31
      if "!LastdayMon!" == "08" set LastdayDay=31
      if "!LastdayMon!" == "09" set LastdayDay=30
      if "!LastdayMon!" == "10" set LastdayDay=31
      if "!LastdayMon!" == "11" set LastdayDay=30
      if "!LastdayMon!" == "12" set LastdayDay=31
     
      if "!LastdayMon!" == "02" (
      set IsLeapYear=
     
      set /A IsLeapYear=!LastdayYear!%%400
      if "!IsLeapYear!" == "0" (
      set LastdayDay=29
      goto MAKELASTDATE
      )
     
      set /A IsLeapYear=!LastdayYear!%%100
      if "!IsLeapYear!" == "0" (
      set LastdayDay=28
      goto MAKELASTDATE
      )
     
      set /A IsLeapYear=!LastdayYear%%4
      if "!IsLeapYear!" == "0" (
      set LastdayDay=29
      goto MAKELASTDATE
      ) else (
      set LastdayDay=28
      goto MAKELASTDATE
      )
      )
    )
     
    :MAKELASTDATE
     
    if "%LastdayDay%" == "1" set LastdayDay=01
    if "%LastdayDay%" == "2" set LastdayDay=02
    if "%LastdayDay%" == "3" set LastdayDay=03
    if "%LastdayDay%" == "4" set LastdayDay=04
    if "%LastdayDay%" == "5" set LastdayDay=05
    if "%LastdayDay%" == "6" set LastdayDay=06
    if "%LastdayDay%" == "7" set LastdayDay=07
    if "%LastdayDay%" == "8" set LastdayDay=08
    if "%LastdayDay%" == "9" set LastdayDay=09
     
    set LastDate=%LastdayYear%%LastdayMon%%LastdayDay%
     
    @echo Today =%date:~0,4%%date:~5,2%%date:~8,2%
    @echo Yestoday=%LastDate%
    pause

    方法二

    @echo off
    set YE=%date:~0,4%
    set MO=%date:~5,2%
    set DA=%date:~8,2%
    set DG=1
    set/a vY1=%YE% %% 400
    set/a vY2=%YE% %% 4
    set/a vY3=%YE% %% 100
    if %vY1%==0 (set var=true) else (if %vY2%==0 (if %vY3%==0 (set var=false) else (set var=true)) else (set var=false))
    set LY=%YE%
    set LM=%MO%
    if %MO:~0,1%==0 (set MO=%MO:~1,1%)
    if %DA:~0,1%==0 (set DA=%DA:~1,1%)
    if %DA% GTR %DG% (set/a LD=%DA%-%DG%) else (
    if %MO%==1 (set/a LY=%YE%-1) & (set/a LM=12) & (set/a LD=31+%DA%-%DG%) else (
    set/a LM=%MO%-1
    if %MO%==3 (if %var%==false (set/a LD=28+%DA%-%DG%) else (set/a LD=29+%DA%-%DG%))
    for %%a in (2 4 6 8 9 11) do (if "%MO%"=="%%a" (set/a LD=31+%DA%-%DG%))
    for %%b in (5 7 10 12) do (if "%MO%"=="%%b" (set/a LD=30+%DA%-%DG%))))
    if %LM% LSS 10 set LM=0%LM:~-1%
    if %LD% LSS 10 set LD=0%LD:~-1%
    set strLstDt=%LY%%LM%%LD%
    echo 昨天的日期为:%strLstDt%
    pause
  • Tomcat7 catalina.out 日志分割

    1、下载cronolog(最新版本)

        #  wget http://cronolog.org/download/cronolog-1.6.2.tar.gz

    [Read More…]

第 1 页,共 1 页1