Skip to main content

May 01, 16

"windows 用命令行进入睡眠
发表于2013 年 10 月 23 日
方法1:

使用windows本身的命令,首先要关闭休眠,否则只能进入休眠状态
powercfg -hibernate off
然后如下命令睡眠
Rundll32.exe Powrprof.dll,SetSuspendState Sleep
方法2:

直接上微软官方网站下个软件PsShutdown.exe,请前往此页点击下载。
然后在命令行里(运行CMD)进入解压后的文件夹中输入:psshutdown.exe -d -t 0
输入psshutdown.exe可以显示帮助

此条目是由ares发表在Other分类目录的。将固定链接加入收藏夹。"

Apr 25, 16

" <isNotNull property="namespaces">  
            namespace in  
            <iterate property="namespaces" open="(" conjunction="," close=")">  
                #namespaces[]#  
                    </iterate>                      
        </isNotNull>  "

Apr 24, 16

"File test operators

Returns true if...

-e
file exists

-a
file exists

This is identical in effect to -e. It has been "deprecated," [1] and its use is discouraged.

-f
file is a regular file (not a directory or device file)

-s
file is not zero size

-d
file is a directory

-b
file is a block device


-c
file is a character device"

Apr 22, 16

"#!/bin/sh

listlines() {
  for i in $*; do
    echo $i
  done
}
        
package=$1
if [ -z "$package" ]; then
  echo "  [Error]: No package name specified"
  exit 1
fi
if [ -d /tmp/tcloop/$package ]; then

  usedby=`lsof +D /tmp/tcloop/$package -Fp | sed -e "s/^p//"`

  if [ "$usedby" ]; then
    echo "Files in extension $package are currently in use by the following programs:"
    usedby=`listlines $usedby | sort -ug`
    for p in $usedby; do
      /bin/ps | awk "/^$p/ "'{$1="";$2="";print $0}'
    done  
    echo "  [Error]: Extension $package has not been unloaded."
    exit 1
  fi
  f=`cd /tmp/tcloop/$package; find ! -type d | sed -e "s%^./%/%"`
  for l in $f; do
     if [ -s $l ]; then
       linkto=`readlink $l`
       if [ "$linkto" == "/tmp/tcloop/$package$l" ]; then
          echo "    Unlink $l from $linkto"
          sudo rm $l
       else
         echo "  [Warning]: $l links to $linkto"
       fi
     else
       echo "  [Warning]: $l is not a link"
     fi
  done
  sudo umount /tmp/tcloop/$package
  sudo rmdir /tmp/tcloop/$package
else
  echo "  [Warning]: /tmp/tcloop/$package does not exist"
fi
sudo rm -f /usr/local/tce.installed/$package"

Apr 20, 16

"ALTER TABLE customers
MODIFY customer_name varchar2(100) not null;"

Apr 19, 16

"Replace 1catalina.org.apache.juli.FileHandler with 1catalina.java.util.logging.FileHandler in the logging.properties file as follows:

handlers = 1catalina.java.util.logging.FileHandler, 2localhost.org.apache.juli.FileHandler, 3manager.org.apache.juli.FileHandler, 4host-manager.org.apache.juli.FileHandler, 5host-manager.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

.handlers = 1catalina.java.util.logging.FileHandler, java.util.logging.ConsoleHandler

1catalina.java.util.logging.FileHandler.level = FINEST
1catalina.java.util.logging.FileHandler.directory=${catalina.base}/../logs
1catalina.java.util.logging.FileHandler.pattern=${catalina.base}/../logs/catalina%g.log
1catalina.java.util.logging.FileHandler.limit = 10000
1catalina.java.util.logging.FileHandler.count = 5
1catalina.java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
"

Apr 16, 16

"私の場合、ディスクイメージはvdiではなくvmdkファイルで、これ自体は問題ないのですが、FedoraでLVMを使っていたため、LVMパッケージを入れる必要があります。

% tce-load -wil lvm2
(ここでpvscan, vgscan, lvscanコマンドなどを使い、ボリュームを確認します)
% vgchange -ay ボリュームグループ名(vgscanで確認したもの)
% mkdir /mnt/oldhome
% mount /dev/ボリュームグループ名/ボリューム名 /mnt/oldhome
(ボリューム名はlvscanで確認しておきます)"

Apr 15, 16

"ssh连接超时时间(ssh timeout)的设置方法
发布时间:2013-06-27编辑:脚本学堂
本文介绍下,linux中ssh连接超时时间的设置方法,以避免总是被强行退出。有需要的朋友,参考下吧。
有关修改ssh连接超时时间的方法,网上介绍的很多了。

比如下面这个:
可以减少ssh连接超时等待的时间:
方法:ssh -o ConnectTimeout=3 192.168.0.10
或修改sshd_config文件里面的UseDNS 选项,改为UseDNS no。

聪明的读者,一定会发现,上面这个修改,其实是减少ssh的连接时间,就是让ssh的响应时间快一些。

这点可以参考之前的一篇文章:ssh连接超时(ssh的usedns选项)的解决办法 。

再来看,设置ssh超时时间的方法。
修改自己 HOME 目录下的.bash_profile文件,加上
export TMOUT=1000000 (以秒为单位)
然后运行:
source .bash_profile"

Apr 15, 16

"SHELL实现取出一个目录下所有日志文件中的所有IP地址并去重

主页 原文:http://blog.51cto.com/8038263/1325916
IP正则表达式:

ip_regex="[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}"



方法一:

find /data/log -name "*.log" -type f -print | xargs cat | egrep -o $ip_regex | sort | uniq



方法二(使用AWK处理):
find /data/log -name "*.log" -type f -print | xargs cat | egrep -o $ip_regex | awk '{
arr[$0] = $0
}
END{
for(i in arr) {
 print arr[i]
}
}'
"

Apr 13, 16

"Simple Sysadmin Trick: Using tcpdump To Sniff Web Server Traffic



October 2, 2012/1 Comment/in Linux, Shell, System Administration /by Dave
Sometimes, you just have to look into the raw data to see what your web server is doing. The logs might not show you enough detail or you suspect something is going on which is just not shown in the log files. Or, as in my case, logging is turned off because of too much activity.

The excellent tcpdump utiliy comes to the rescue here. I recommend you get more familiar with the tcpdump man page. Here is the command you can use, in a nutshell:

1
tcpdump -nl -w - -i eth1 -c 500 port 80|strings
or alternatively with just tcpdump (Thanks Chris!):

1
tcpdump -nl -s 0 -A -i eth1 -c 500 port 80
Your command line will print out all traffic exiting your server from port 80, headers and all. Lets look at the options in more detail.

-n: Don’t convert addresses (i.e., host addresses, port numbers, etc.) to names.
-l: Make stdout line buffered. Useful if you want to see the data while capturing it.
-w: Write the raw packets to file rather than parsing and printing them out. (Sent to stdout)
-i: Interface you want to sniff on, usually eth0 or eth1, but depends on your system.
-c: Number of packets to capture
port: port 80, duh :)
-A: Print each packet (minus its link level header) in ASCII.
-s: size"

1 - 20 of 3788 Next › Last »
20 items/page

Highlighter, Sticky notes, Tagging, Groups and Network: integrated suite dramatically boosting research productivity. Learn more »

Join Diigo