Chinaunix首页 | 论坛 | 博客
  • 博客访问: 520610
  • 博文数量: 102
  • 博客积分: 950
  • 博客等级: 准尉
  • 技术积分: 1094
  • 用 户 组: 普通用户
  • 注册时间: 2010-07-28 16:07
文章分类

全部博文(102)

文章存档

2020年(2)

2016年(5)

2015年(15)

2014年(25)

2013年(18)

2012年(19)

2011年(18)

我的朋友

分类: LINUX

2014-07-07 10:36:44

1. 时间

    前一小时

    prehour = datetime.datetime.now() - datetime.timedelta(hours=1)

    logdate = prehour.strftime("%F")
    loghour = prehour.strftime("%H")


    

    begintime = datetime.datetime.now().strftime("%F %H:%M:%S")



    curmin = time.strftime('%M', time.localtime(time.time()))


2. 脚本参数化处理

    if len(sys.argv) != 3 :
    print "usage " +sys.argv[0] +" game  jobid"
    exit(1)

    note:argv的数量包括脚本名,是argv[0],两个参数,总数就是3个


3. 执行脚本命令

    update_cmd = "/usr/bin/python %s %s \"%s\"" % (updatecmd, jobid, info)
    status, output = commands.getstatusoutput(update_cmd)
    if status != 0:
        print "%s failed" % update_zeus_cmd


阅读(697) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~