??xml version="1.0" encoding="utf-8" standalone="yes"?>国产精品免费久久久久,欧美日韩精品免费,欧美亚洲国产一区http://www.aygfsteel.com/Skynet/category/35350.htmlzh-cnMon, 07 Dec 2009 22:07:27 GMTMon, 07 Dec 2009 22:07:27 GMT60linux date 使用http://www.aygfsteel.com/Skynet/archive/2009/12/07/305016.html刘凯?/dc:creator>刘凯?/author>Mon, 07 Dec 2009 08:14:00 GMThttp://www.aygfsteel.com/Skynet/archive/2009/12/07/305016.htmlhttp://www.aygfsteel.com/Skynet/comments/305016.htmlhttp://www.aygfsteel.com/Skynet/archive/2009/12/07/305016.html#Feedback1http://www.aygfsteel.com/Skynet/comments/commentRss/305016.htmlhttp://www.aygfsteel.com/Skynet/services/trackbacks/305016.html date demo:
实例:
$
>date
Mon Dec  
7 15:43:39 CST 2009

#格式化输?/span>
$> date +"%Y-%m-%d"
2009-12-07

#旉游走 当前旉 2009-12-07
# year , month , day ,hour , minute,second  - ago
#昨天输出

$> date  -"1 day ago" +"%Y-%m-%d"
2009-12-06

#2U后输出
$> date  -"2 second" +"%Y-%m-%d %H:%M.%S"
2009-12-07 15:50.04

#传说中的 1234567890 U?/span>
$>date -"1970-01-01  1234567890 seconds"  +"%Y-%m-%d %H:%m:%S"
2009-02-13 23:02:30

#其他格式的{?/span>
date -"$(echo "03/Nov/2009 11:04:28" |perl -ne 'print "$2 $1 $3 $4\n" if /(.*?)"/(.*?)"/(.*?) (.*)/;') " +%Y-%m-%d
2009-11-03

#普?nbsp;转格?/span>
$> date -"2009-12-12" +"%Y/%m/%d %H:%M.%S"
2009/12/12 00:00.00

#apache 格式转换
$>date  -"Dec 5, 2009 12:00:37 AM" +"%Y-%m-%d %H:%M.%S"
2009-12-05 00:00.37

#格式转换 后时?nbsp;游走
$>date  -"Dec 5, 2009 12:00:37 AM 2 year ago" +"%Y-%m-%d %H:%M.%S"
2007-12-05 00:00.37


#旉?br /> #一时 3600
#一?nbsp;86400 U?/span>
$>st=$(date  -"Dec 5, 2009 12:00:37 AM 1 day ago 1 hour ago " +"%s")
$
>et=$(date  -"Dec 5, 2009 12:00:37 AM" +"%s")
$
>echo "旉?[($et-$st)/86400]天,$[($et-$st)/3600%24]时"
旉?天,1时





date --help
Usage: date [OPTION] [+FORMAT]
  or
:  date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
Display the current 
time in the given FORMAT, or set the system date.

  
-d, --date=STRING         display time described by STRING, not `now'
  -f, --file=DATEFILE       like --date once for each line of DATEFILE
  -r, --reference=FILE      display the last modification time of FILE
  -R, --rfc-2822            output date and time in RFC 2822 format
      --rfc-3339=TIMESPEC   output date and time in RFC 3339 format.
                            TIMESPEC=`date
', `seconds', or `ns' for
                            date and 
time to the indicated precision.
  
-s, --set=STRING          set time described by STRING
  
-u, --utc, --universal    print or set Coordinated Universal Time
      
--help     display this help and exit
      
--version  output version information and exit
















]]>
shell txt 分析结http://www.aygfsteel.com/Skynet/archive/2009/11/26/303750.html刘凯?/dc:creator>刘凯?/author>Thu, 26 Nov 2009 03:27:00 GMThttp://www.aygfsteel.com/Skynet/archive/2009/11/26/303750.htmlhttp://www.aygfsteel.com/Skynet/comments/303750.htmlhttp://www.aygfsteel.com/Skynet/archive/2009/11/26/303750.html#Feedback1http://www.aygfsteel.com/Skynet/comments/commentRss/303750.htmlhttp://www.aygfsteel.com/Skynet/services/trackbacks/303750.html




]]>
使用rsync同步|络备䆾(?http://www.aygfsteel.com/Skynet/archive/2009/10/28/300092.html刘凯?/dc:creator>刘凯?/author>Wed, 28 Oct 2009 09:55:00 GMThttp://www.aygfsteel.com/Skynet/archive/2009/10/28/300092.htmlhttp://www.aygfsteel.com/Skynet/comments/300092.htmlhttp://www.aygfsteel.com/Skynet/archive/2009/10/28/300092.html#Feedback0http://www.aygfsteel.com/Skynet/comments/commentRss/300092.htmlhttp://www.aygfsteel.com/Skynet/services/trackbacks/300092.html使用rsync同步|络备䆾
 
 
一. ?
rsync常用的备份工? 它目前是?rsync.samba.org l护.
rsync使用所谓的"rsync法",提供一个非常快速的档案传输Ҏ, 使local和远端二部主Z间的档案辑ֈ同步,它主要是传送二个档案的异动部䆾,而非每次都整份传? 因此速度相当地快. 
rsync它可以搭配rsh或sshQ也可以当成daemon模式使用直接的socketq接, 所以rsync可以当做一个优异的备䆾工具来? 
我这单介l运用rsync备䆾q程|\L档案的基本方法?
在这,我们是给rsync当成linux的一Udaemon模式来运?

首先,先给个简单的定义:当然要一Crsync daemon模式, 我们qq台机器Zrsync Server, 或者说q台L是一台备份主? Backup Server).
备䆾L会开启一?73的端?port), {待Ҏrsyncq接.所以服务器记的要开q个端口

q接? rsync Server 会检查密码是否相W? 若通过密码查核, 则开始进行档案传?
W一ơ连通完成时, 会把整䆾档案传输一? 下一ơ就只传送二个档案之间异动的部䆾. 
以上是rsync client (Ʋ加以备份的q程|\L) 和rsync server 的运作方式?
 
藉由上述Ҏ, 我们当然也可以设立多部备份主? 使网路主Z重要的档案能分散x部主Z, 以分散风? 
一旦完成备? 我们可以对这些备份主机再做进一步的储存动作, 如用tar打成tar的包, 把档案备份到盘之类.

以下内容Q我用Ubuntu 7.10做客h,Centos5做服务器试q?
  
 
? 安装?
 
rsync目前最新版?2.6.8, 可以到rsync.samba.org 下蝲.
若您使用 rpm 套g,L下面的方法安?当然rhel5和centos5中默认就安装?br /> #rpm -ivh rsync*.rpm
#yum install rsync
 
它的讑֮档位|在 /etc/rsyncd.conf,奇怪,我的没有自动生成q个文gQ那我们来自己配置?
 
 
 
? 讑֮ rsync server: (假设q台L名称?rsync.x111.com)
 
rsync server 端要讑֮以下四项:
 
   1.规划建立备䆾目录?nbsp;
 
   2.启动xinetd中的rsync  
   3.讑֮: /etc/rsyncd.conf 
 
   4.讑֮: 密码?nbsp;
 
依次说明如下:
 
1. 规划建立备䆾目录?
您准备一个容量较大且独立的分割区, q在其中开好备份目? 如此 /blackup/x99
 
2. 启动xinetd中的rsync
pȝ默认没有安装xinetd?
# yum install xinetd
#service xinetd restart
#chkconfig rsync on
 
以上的操?主要是要打开rsyncq个daemon,一旦有rsync client要连接时,xinetd会把它{介给rsyncd (port 873). 
 
 
3. 讑֮ /etc/rsyncd.conf : 
全局讄
    uid = root
    gid = root
    use chroot = no                # 不用chroot
    max connections = 4         # 最大连接数?
    pid file = /var/run/rsyncd.pid
    lock file = /var/run/rsync.lock
    log file = /var/log/rsyncd.log    # 日志记录文g
 
以下的部?代表开攄某一台rsync client L的设? 单范本如? 
    [x99]
    path = /blackup/x99/x99_backup   
    auth users = x99_backup
    secrets file = /etc/rsyncd.secrets
    read only = no
 
 
以上文g的注? 
 
[x99] 代表要备份的L代号, 名称自己讄.
 
path 用来讑֮备䆾档案要存攑֜那一个目?q个可先要mkdir开?可以自己讄
auth users 代表授权的帐? 可以自己讄.
secrets file 代表储存帐号密码的密码档, 其放|的路径档名.
 
当然, q台备䆾L, 可以容纳许多 rsync client q接, 只要?rsyncd.conf中设|对应的多个部分卛_.
 
以下例子,代表二个Lx99及x100Ʋ备份进?
 
 
 
    [x99]
    path = /blackup/x99/x99_backup
    comment = XXXXX
    auth users = x99_backup
    secrets file = /etc/rsyncd.secrets
    read only = no
   
    [x100]
    path = /blackup/x100/x100_backup
    auth users = x100_backup
    secrets file = /etc/rsyncd.secrets
    read only = no
 
 
 
4. 讑֮密码文g:
 
rsyncd.secrets 的内容很Ҏ, 格式?帐号:密码";
如以下例?
x99_backup:x99pass
注意! 上述讑֮只是一个例?你自p|可一定千万不要直接套?
接下? 要将 rsyncd.secrets q个密码档的档案属性设为root拥有, 且权限要设ؓ600, 否则无法备䆾成功!
 
因此, 请下: 
#chown root.root rsyncd.secrets 
#chmod 600 rsyncd.secrets 
 
x, rsync的服务器q端已设定完? 若欲查看备䆾日志.
#tail -f /var/log/rsyncd.log
 
 

接下来是 client ?x备䆾的网l主? 的设?
 
 
? 讑֮ rsync client (假设q台L IP ?: 11.22.33.44)
步骤:
 
   1.讑֮密码?nbsp;
 
   2.试rsync命o是否可以正常 
 
   3.rsync指o攑օ定时d(crontab) 
 
另外, 假设x99q台L是网路上的服务器, 现打把/var/www/htmlq个目录加以备䆾至backup server(上面讲的rsync.x111.com), 
 
但不惛_份下面的目录中的内容/html/logQ?也就是说要把/html/log目录排除), 整个操作方式如下:
 
1. 假设把密码档攑֜ /root/rsyncd.secrets, 内容只要含有密码一行即?
 
x99pass
 
注意: rsyncd.secrets 的权限属性必设?00,讄Ҏ见上?
 
2. 试指o是否可以成功?
 
/usr/bin/rsync -rvztopglHpogDtS --progress  --password-file=/root/rsyncd.secrets /var/www/html --exclude /html/log x99_backup@rsync.x111.com::x99
 
? 出现传输目录档案的画? 卌C测试成?上面q个命o行中-rv里的v是verboseQz是压~,r是递归Q字目录一_topg都是保持文g原有属性如属主、时间的参数? --progress是指昄l的q度情况Q?-delete是指如果服务器端删除了这一文gQ那么客L也相应把文g删除Q保持真正的一致。后面的 x99_backup@ip中,的x99_backup是指的用户名
 
3. |入工作排程, 假设每天凌晨5点开始备?
 
crontab -u root -e
0 5 * * * /usr/bin/rsync -rvlHpogDtS --password-file=/root/rsyncd.secrets /var/www/html --exclude apache /html/log x99_backup@rsync.x111.com::x99
 
若您有其它目??/home)要备? 则如法? 20 5 * * * /usr/bin/rsync -rvlHpogDtS --password-file=/root/rsyncd.secrets /home x99_bakup@rsync.x111.com::x99
 
当然您觉得备份一台Backup Server不够,q可再按上述Ҏ,自行增加L多台Backup Server, 以分散风?
 
 
? 安全?
 
防火墙的 iptables 指o, 来限?rsync client 的连U范? 例子如下:
 
iptables -A INPUT -p tcp -s ! xx.xx.xx.xx --dport 873 -j DROP
 
如此, 只有 xx.xx.xx.xx q个 client IP 能连入这?rsync server.


?
详细格式说明Q?br /> -v, --verbose 详细模式输出
-q, --quiet _输出模式
-c, --checksum 打开校验开养I强制Ҏ件传输进行校?br /> -a, --archive 归档模式Q表CZ递归方式传输文gQƈ保持所有文件属性,{于-rlptgoD
-r, --recursive 对子目录以递归模式处理
-R, --relative 使用相对路径信息
-b, --backup 创徏备䆾Q也是对于目的已经存在有同L文g名时Q将老的文g重新命名?br /> ~filename。可以?-suffix选项来指定不同的备䆾文g前缀?br /> --backup-dir 备份文?如~filename)存放在在目录下?br /> -suffix=SUFFIX 定义备䆾文g前缀
-u, --update 仅仅q行更新Q也是跌所有已l存在于DSTQƈ且文件时间晚于要备䆾的文件?br /> (不覆盖更新的文g)
-l, --links 保留软链l?br /> -L, --copy-links 惛_待常规文件一样处理Y铄
--copy-unsafe-links 仅仅拯指向SRC路径目录树以外的铄
--safe-links 忽略指向SRC路径目录树以外的铄
-H, --hard-links 保留链l?br /> -p, --perms 保持文g权限
-o, --owner 保持文g属主信息
-g, --group 保持文g属组信息
-D, --devices 保持讑֤文g信息
-t, --times 保持文g旉信息
-S, --sparse 对稀疏文件进行特D处理以节省DST的空?br /> -n, --dry-run现实哪些文g被传输
-W, --whole-file 拯文gQ不q行增量?br /> -x, --one-file-system 不要跨越文gpȝ边界
-B, --block-size=SIZE 验算法用的块尺寸,默认?00字节
-e, --rsh=COMMAND 指定替代rsh的shellE序
--rsync-path=PATH 指定q程服务器上的rsync命o所在\径信?br /> -C, --cvs-exclude 使用和CVS一LҎ自动忽略文gQ用来排除那些不希望传输的文?br /> --existing 仅仅更新那些已经存在于DST的文Ӟ而不备䆾那些新创建的文g
--delete 删除那些DST中SRC没有的文?br /> --delete-excluded 同样删除接收端那些被该选项指定排除的文?br /> --delete-after 传输l束以后再删?br /> --ignore-errors 及时出现IO错误也进行删?br /> --max-delete=NUM 最多删除NUM个文?br /> --partial 保留那些因故没有完全传输的文Ӟ以是加快随后的再ơ传?br /> --force 强制删除目录Q即使不为空
--numeric-ids 不将数字的用户和lID匚w为用户名和组?br /> --timeout=TIME IP时旉Q单位ؓU?br /> -I, --ignore-times 不蟩q那些有同样的时间和长度的文?br /> --size-only 当决定是否要备䆾文gӞ仅仅察看文g大小而不考虑文g旉
--modify-window=NUM 军_文g是否旉相同时用的旉戳窗口,默认?
-T --temp-dir=DIR 在DIR中创Z时文?br /> --compare-dest=DIR 同样比较DIR中的文g来决定是否需要备?br /> -P {同?--partial --progress 昄备䆾q程
-z, --compress 对备份的文g在传输时q行压羃处理
--exclude=PATTERN 指定排除不需要传输的文g模式
--include=PATTERN 指定不排除而需要传输的文g模式
--exclude-from=FILE 排除FILE中指定模式的文g
--include-from=FILE 不排除FILE指定模式匚w的文?br /> --version 打印版本信息
--address l定到特定的地址
--config=FILE 指定其他的配|文Ӟ不用默认的rsyncd.conf文g
--port=PORT 指定其他的rsync服务端口
--blocking-io 对远Eshell使用dIO
-stats l出某些文g的传输状?br /> --progress 在传输时现实传输q程
--log-format=FORMAT 指定日志文g格式
--password-file=FILE 从FILE中得到密?br /> --bwlimit=KBPS 限制I/O带宽QKBytes per second
-h, --help 昄帮助信息


转自 http://blog.csdn.net/KataDoc360/archive/2009/03/16/3995559.aspx


]]>
mysql数据定时导入脚本(shell)http://www.aygfsteel.com/Skynet/archive/2009/10/23/299458.html刘凯?/dc:creator>刘凯?/author>Fri, 23 Oct 2009 02:51:00 GMThttp://www.aygfsteel.com/Skynet/archive/2009/10/23/299458.htmlhttp://www.aygfsteel.com/Skynet/comments/299458.htmlhttp://www.aygfsteel.com/Skynet/archive/2009/10/23/299458.html#Feedback1http://www.aygfsteel.com/Skynet/comments/commentRss/299458.htmlhttp://www.aygfsteel.com/Skynet/services/trackbacks/299458.html 在服务器上发现的定时的导入脚本,记录下来。还是很有用?br /> 30 06 * * * /data/dmsp/shell/crontab_search_stats_import.sh >> /data/dmsp/logs/crontab_search_stats_import.log
#!/bin/sh

y
=$(date -"-1 day" +%Y)
m
=$(date -"-1 day" +%m)
d
=$(date -"-1 day" +%d)

#/data/dmsp/ftp/dim_stats/2009/09/14

act
=dim_stats
mypath
=/data/dmsp/ftp/${act}/${y}/${m}/$wmqeeuq/

echo $mypath
statpath
=${mypath}${act}${y}${m}$wmqeeuq.tar.bz2.state

for(( j=1; j<10000; j=j+1))
do
    
if [ -"${statpath}" ] ; then
              tar xjf ${mypath}${act}${y}${m}$wmqeeuq.tar.bz2 
-C ${mypath}
                mysql 
-127.0.0.1 -P3306 -u root -pmysql -"LOAD DATA INFILE '${mypath}part-00000' INTO TABLE dmsp.dmsp_veidoo character set utf8 FIELDS TERMINATED BY '\t' lines terminated by '\n'";
        
break    
    
else
        echo 
"[${j}:1000] not ready. sleep 10 seconds then retry."
        sleep 
10
    fi
don




]]>
shell 一行命令(记入中)http://www.aygfsteel.com/Skynet/archive/2009/04/23/267187.html刘凯?/dc:creator>刘凯?/author>Thu, 23 Apr 2009 09:20:00 GMThttp://www.aygfsteel.com/Skynet/archive/2009/04/23/267187.htmlhttp://www.aygfsteel.com/Skynet/comments/267187.htmlhttp://www.aygfsteel.com/Skynet/archive/2009/04/23/267187.html#Feedback0http://www.aygfsteel.com/Skynet/comments/commentRss/267187.htmlhttp://www.aygfsteel.com/Skynet/services/trackbacks/267187.html 1. 去除 I
sed 'N;s/"n/ /g'  file




]]>
shell 删除I文件夹 http://www.aygfsteel.com/Skynet/archive/2009/03/18/260485.html刘凯?/dc:creator>刘凯?/author>Wed, 18 Mar 2009 07:03:00 GMThttp://www.aygfsteel.com/Skynet/archive/2009/03/18/260485.htmlhttp://www.aygfsteel.com/Skynet/comments/260485.htmlhttp://www.aygfsteel.com/Skynet/archive/2009/03/18/260485.html#Feedback2http://www.aygfsteel.com/Skynet/comments/commentRss/260485.htmlhttp://www.aygfsteel.com/Skynet/services/trackbacks/260485.html 1.windows cygwin 版本 
  find . -type d|
   
du |
    
gawk '{if($1=="0"){print $2}}' |     #我这使用 cygwin判断 $1==0  ,如果使用 linux 那就 $1=="4"
       sort 
-ru |
         gawk '{system(
"rmdir "$0)}'

2.linux  版本(其实Q这个太不严?)
find . -type d|
    du 
-|
     gawk 
'{if($1=="4"){print $2}}' |   
       
sort -ru |
         gawk 
'{system("rmdir "$0)}'

3.shell + python
查找 文g夹大py,参考:获取文g夹大的python代码
#!/bin/python
import os,sys
from os.path import join, getsize

def getdirsize(dir):
        size 
= 0L;
        
for root, dirs, files in os.walk(dir):
               
size += sum([ getdirsize(join(root,dname)) for dname in dirs ]);
                size += sum([getsize(join(root, name)) for name in files]);
                
return size;

dir_path
=sys.argv[1];
filesize 
= getdirsize(dir_path);
print dir_path,"\t",filesize ;

shell
find . -type d -exec python getDirSize.py {} \;|
sort
 -ru |
gawk 
'{if($2=="0"){print $1}}' |
gawk 
'{system(" rmdir "$0)}'





find . -type d #查找文g?/strong>
du  #文g夹大?/strong>
gawk '{if($1=="0"){print $2}}' #文g夹ؓ 0 输出
sort -ru #为删除准? 比如 文g?./t1 I?./t1/t11 I?。排序ؓ ?./t1/t11 ?./t1 。这删除׃会错  )
gawk '{system("rmdir "$0)}' #野蛮的删?/strong>







其他Q?br /> l合sort -u  可以扑և最或最?几个文g

#!python
#
 python this.py /home/xj_liukaiyi/imusic/ ".*128kbps\/.*\.mp3"
import os,sys,re
from os.path import join, getsize

def getdirsize(dir,refile):
    
for root, dirs, files in os.walk(dir):
    
for dname in dirs :
        getdirsize(join(root,dname),refile)
        
for name in files :
            ffname
=join(root,name)
            
if re.search(refile,ffname):
                
print "%09d\t%s" % (getsize(ffname),ffname)

dir_path
=sys.argv[1];
file_re
=sys.argv[2];

filesize 
= getdirsize(dir_path,file_re);




]]>
memcachedb http://www.aygfsteel.com/Skynet/archive/2009/02/26/256836.html刘凯?/dc:creator>刘凯?/author>Thu, 26 Feb 2009 08:23:00 GMThttp://www.aygfsteel.com/Skynet/archive/2009/02/26/256836.htmlhttp://www.aygfsteel.com/Skynet/comments/256836.htmlhttp://www.aygfsteel.com/Skynet/archive/2009/02/26/256836.html#Feedback0http://www.aygfsteel.com/Skynet/comments/commentRss/256836.htmlhttp://www.aygfsteel.com/Skynet/services/trackbacks/256836.html 安装参考:
   http://www.cnblogs.com/cerxp/archive/2008/04/22/1165620.html

相对 memcached 增强的功能:
  1. 坠机后,“~存”初始化回到断电前
  2. 支持同步Q可看成集群Q?a id="AjaxHolder_ctl01_TitleUrl" class="postTitle2" >Memcachedb 单?/a>

代hQ?br />   ?memcached ?15%
参考:http://swik.net/Jabber-linux/Jabber+XMPP+resource/memcachedb%E7%9A%84%E6%80%A7%E8%83%BD%E6%B5%8B%E8%AF%95/b1odq



]]>
log4j perl 错误日志提取http://www.aygfsteel.com/Skynet/archive/2009/02/19/255445.html刘凯?/dc:creator>刘凯?/author>Thu, 19 Feb 2009 05:01:00 GMThttp://www.aygfsteel.com/Skynet/archive/2009/02/19/255445.htmlhttp://www.aygfsteel.com/Skynet/comments/255445.htmlhttp://www.aygfsteel.com/Skynet/archive/2009/02/19/255445.html#Feedback0http://www.aygfsteel.com/Skynet/comments/commentRss/255445.htmlhttp://www.aygfsteel.com/Skynet/services/trackbacks/255445.html 日志
#!/bin/perl
use Encode ;
open(NOTESFILES,$ARGV[0]);

my %errorMeganotes;

print ">>>>>>>>>>>>>>",$ARGV[0],"<<<<<<<<<<\n";

while (<NOTESFILES>) {
  
if$_=~/^(\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2})\s+ERROR\s+(.*)\s/g ){
     
if($errorMeganotes{$2}){
       
push @{$errorMeganotes{$2}},$1;
     }
else{
       
$errorMeganotes{$2}=[$1];
     }
  }
}

for(keys %errorMeganotes){
  
my $tmp_keys=$_;
  
my @tmp_array= @{$errorMeganotes{$tmp_keys}};
  
print "error number :>>",scalar(@tmp_array),"<<\n",encode("GBK",decode("UTF-8",$tmp_keys)),"\n",join(",\t",@tmp_array),"\n\n\n";
}


sh
#!/bin/sh
nowDate=$(date -'-1 day' +%Y-%m-%d);
echo $nowDate

perl 
/data/apps/shell/meganotesErrorLog.pl /data/apps/meganotes/tomcat/logs/app/app.log.$nowDate >  _tmp_$nowDate ;
perl 
/data/apps/shell/meganotesErrorLog.pl /data/apps/schedule/tomcat/logs/app/app.log.$nowDate  >> _tmp_$nowDate ;


mail 
-s $nowDate-ERROR-log  my@mail.com  <  _tmp_$nowDate;
rm _tmp_$nowDate ;

l果Q?br /> >>>>>>>/data/apps/meganotes/tomcat/logs/app/app.log.2009-02-18<<<<<<<<<
error number :>>2<<
MusicActionOpLogProxy:142 - music.popularTime=[Invalid field value for field "music.popularTime".]
2009-02-18 15:53:54,    2009-02-18 16:00:12
。。。。。?br />




]]>
shell if 使用 http://www.aygfsteel.com/Skynet/archive/2009/02/02/252918.html刘凯?/dc:creator>刘凯?/author>Mon, 02 Feb 2009 02:35:00 GMThttp://www.aygfsteel.com/Skynet/archive/2009/02/02/252918.htmlhttp://www.aygfsteel.com/Skynet/comments/252918.htmlhttp://www.aygfsteel.com/Skynet/archive/2009/02/02/252918.html#Feedback1http://www.aygfsteel.com/Skynet/comments/commentRss/252918.htmlhttp://www.aygfsteel.com/Skynet/services/trackbacks/252918.html ?shell 使用 if  留个?br /> 说明Q?br />    下面可学习到
       1. ?sh 文g接受?2个,1个,或无参数?解决办法(注意 $1 ?"$1" q样使用 )
       2. sh ?参数赋?_var = $(...)
       3. 取得当前旉  $(date +%Y-%m-%d) 前天旉 $(date -d '-1 day' +%Y-%m-%d)

if [ -n "$2" ] ; then
     mydate
=$1
     _copyright
=/data/ftp_share/copyright/$2-copyright.000
     _walkman
=/data/ftp_share/copyright/$2-walkman.000
     _fullsong
=/data/ftp_share/copyright/$2-fullsong.000
     _shaker
=/data/ftp_share/copyright/$2-shaker.000
     _color
=/data/ftp_share/copyright/$2-color.000
elif  [ 
-n "$1" ]  ;then
  mydate
=$1
  _copyright
=$(python findIncBizDataFile.py copyright $1)
 _walkman
=$(python findIncBizDataFile.py  walkman $1)
 _fullsong
=$(python findIncBizDataFile.py  fullsong $1)
 _shaker
=$(python findIncBizDataFile.py  shaker $1)
 _color
=$(python findIncBizDataFile.py  color $1)    
else    
  
#ydate=$(date -d '-1 day' +%Y-%m-%d)
  mydate=$(date +%Y-%m-%d)
  _copyright
=$(python findIncBizDataFile.py copyright)
 _walkman
=$(python findIncBizDataFile.py walkman)
 _fullsong
=$(python findIncBizDataFile.py fullsong)
 _shaker
=$(python findIncBizDataFile.py shaker)
 _color
=$(python findIncBizDataFile.py color)
fi;





if 参数说明
  • –b 当file存在q且是块文g时返回真
  • -c 当file存在q且是字W文件时q回?
  • -d 当pathname存在q且是一个目录时q回?
  • -e 当pathname指定的文件或目录存在时返回真
  • -f 当file存在q且是正规文件时q回?
  • -g 当由pathname指定的文件或目录存在q且讄了SGID位时q回为真
  • -h 当file存在q且是符号链接文件时q回真,该选项在一些老系l上无效
  • -k 当由pathname指定的文件或目录存在q且讄?#8220;_滞”位时q回?
  • -p 当file存在q且是命令管道时q回为真
  • -r 当由pathname指定的文件或目录存在q且可读时返回ؓ?
  • -s 当file存在文g大小大于0时返回真
  • -u 当由pathname指定的文件或目录存在q且讄了SUID位时q回?
  • -w 当由pathname指定的文件或目录存在q且可执行时q回真。一个目录ؓ了它的内容被讉K必然是可执行的?
  • -o 当由pathname指定的文件或目录存在q且被子当前q程的有效用户ID所指定的用h有时q回真?

UNIX Shell 里面比较字符写法Q?/font>

  • -eq   {于
  • -ne    不等?
  • -gt    大于
  • -lt    于
  • -le    于{于
  • -ge   大于{于
  • -z    IZ
  • =     两个字符相等
  • !=    两个字符不等
  • -n    非空?/font>


在这有个比较郁闷的地?Q?strong>?a id="AjaxHolder_Comments_CommentList_ctl01_NameLink" target="_blank">sunnycare指正Q问题经q修?/a>
Q?br />   有那?能帮我下 if and 使用
比如Q?br />
if [ -z ] && [ -z ]; then echo 11else echo 22; fi;
l果 
11 Q正)

if [ -1 ] && [ -n ]; then echo 11else echo 22; fi;
l果 
11 Q错误)
q是 不能理解?nbsp;地方Q?/strong>

if [ -1 ] && [ -'' ]; then echo 11else echo 22; fi;
?br />
if [ -1 ] && [ -"" ]; then echo 11else echo 22; fi;
l果 
22 Q正)

应该?22 但结果是 11 郁闷Q!





]]>
sNoteQ自q学习W记Q想?http://www.aygfsteel.com/Skynet/archive/2008/12/10/245420.html刘凯?/dc:creator>刘凯?/author>Wed, 10 Dec 2008 02:36:00 GMThttp://www.aygfsteel.com/Skynet/archive/2008/12/10/245420.htmlhttp://www.aygfsteel.com/Skynet/comments/245420.htmlhttp://www.aygfsteel.com/Skynet/archive/2008/12/10/245420.html#Feedback0http://www.aygfsteel.com/Skynet/comments/commentRss/245420.htmlhttp://www.aygfsteel.com/Skynet/services/trackbacks/245420.html http://www.aygfsteel.com/Files/Skynet/turtle.rar
(目前目什么都没有 Q就是个架子 。有旉会跟新的 Q如果有人想加入Q请联系?liukaiyi@gmail.com)
׃旉_略 Q写的ؕ。不q想法很好(安全什么叫别说了,定位是l自q的)
刚处?shell <-> py q问题 Q留?
׃万恶的Windows dos 使用gbk ~码 Q导致我q他?comm 一定要使用 ~码转换
从页面接受到到的命o Q?br /> commCharset="GBK"
sh_comm=sh_comm.encode(commCharset)
q行命o得到的结?br /> fp=os.popen(sh_comm)
sh_comm_value=unicode(fp.read(), commCharset)



 你想要的学习W记?= web + shell + python + 文本  Q?/strong>

x是:通过web 使用shell强大的文本处理功能。帮助你整理学习W记
比如Q?br /> 一个py 中文处理你刚解决Q到面?随便输入 你解决的办法Q脓个关键字?br /> 下次

findWords.shQshell 自己定义Q当然可以用web 包装?Q?>>
#/bin/shell
find / -type f -name | grep $1
findWords.sh 中文处理

http://www.aygfsteel.com/Files/Skynet/turtle.rar

目说明 Q?br /> 目目前使用 windows + cygWin shell
配置?django
使用 eclipes + ant Qpybuild.xmlQ?br /> 上面的运行只是能单在web中的q行shell和展现运行结?br /> q行l果

shell 命o
ls -l
总计 96
drwxr-xr-x 4 Administrator None 0 Dec 2 14:11 myTurtle
-rw-r--r-- 1 Administrator None 21 Dec 2 14:34 pybuild.properties
-rw-r--r-- 1 Administrator None 1040 Dec 2 14:16 pybuild.xml
drwxr-xr-x 2 Administrator None 0 Dec 2 17:07 shell
-rw-r--r-- 1 Administrator None 164 Dec 2 16:47 需?br />

]]>
window grep vim http://www.aygfsteel.com/Skynet/archive/2008/10/20/235439.html刘凯?/dc:creator>刘凯?/author>Mon, 20 Oct 2008 05:36:00 GMThttp://www.aygfsteel.com/Skynet/archive/2008/10/20/235439.htmlhttp://www.aygfsteel.com/Skynet/comments/235439.htmlhttp://www.aygfsteel.com/Skynet/archive/2008/10/20/235439.html#Feedback3http://www.aygfsteel.com/Skynet/comments/commentRss/235439.htmlhttp://www.aygfsteel.com/Skynet/services/trackbacks/235439.html _copyright=$(python findIncBizDataFile.py copyright)


可以参考:
cygWin: http://blog.chinaunix.net/u/19782/showart_408547.html
1>. 安装cygwinQ他可以满你大部分Linux命o的需要。真是个好东ѝ?br />     下蝲的地址为:http://www.cygwin.com/
完成后设|?bin 到path?ok!

安装 gvim gvim72.exe
http://www.vim.org/


grep
   文本查找Q?grep -nr "string with space" ./*

find
   find . -name '*[html!py]'
   文gҎ旉Qfind . -type f -amin +1
                 find . -name '*c*' -type f  -maxdepth 2
                 find . -name '*ction*.java' -exec cat -n {}  ; |less


find + grep
   find . -type f -name "*.txt" |xargs grep 'use this' -n
 查询?file 文g新的.
   find . -type f -name "*.txt" -newer ./lib/hadoop-0.18.1/kfs-0.1.LICENSE.txt|xargs grep 'sf' -ln

find+cp
find ./lib -type f -name  '*.jar' -exec cp -rf {}  ./mn_mod_admin/WebRoot/WEB-INF/lib ;

替换Q?/strong>
find -type f -name Root -exec  sed -i 's/59.151.33.197/cvs.xunjienet.cn/g' {} ;

道Q?/strong>
 -ok 每次执行会询问?
 -exec 直接q行!
 |args 直接q行 但上得结果默认插入后句最后?br />


gvim q解决Qhttp://www.cnblogs.com/shipfi/archive/2008/04/07/1140025.html
把以下设|添加到.vimrc中?br /> set encoding=utf-8
set fileencodings=utf-8,chinese,latin-1
if has("win32")
  set fileencoding=chinese
else
  set fileencoding=utf-8
endif
language message zh_CN.utf-8
"解决菜单q
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim


命o集合Q?br /> :ls  :n
:edit filename
:split :vsplit  Ctrl-w w











gvim +11 file.txt
昄行号Qset nu
替换Qhttp://ks.cn.yahoo.com/question/1408012501095.html
      :%s/four/4/g

光标定位Q?


]]>
վ֩ģ壺 ͨ| ʯ̨| ƽ| | ɽ| ƺ| | Ӣɳ| | | | | | ƽ| ɽ| | Ϻ| ƽ| ʯ| «ɽ| ͤ| ʡ| | ɽ| ׼| | ²| | | | ͭ| ֯| ʩ| | Դ| żҿ| | Դ| Ͻ| | ˺|