-
Notifications
You must be signed in to change notification settings - Fork 1
/
interface.py
37 lines (31 loc) · 983 Bytes
/
interface.py
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
# -*- coding:utf-8 -*-
#!/usr/bin/python
#Filename:interface.py
#For:stastic interface useage during a period
import os
import time
#source dirs
#sources='/home/licb'
print 'Useage:you should input the dir path end with os.path!\
\nes:/home/licb/'
sources=raw_input('please input the absolute path of the source dir:')
#list all of the files except hidden ones
#the files you want to list,names must be tuple but not list!!!
names=('umserver.log.201302','umserver.log.201303')
fileList=os.listdir(sources)
for name in fileList:
if name.startswith('.'):
continue
#elif name.startswith('umserver.log.201302') or name.startswith('umserver.log.201303'):
elif name.startswith(names):
print name
cmd="cat %s%s|grep '>>>>,UUID'|awk -F'REQ_ACTION:' '{print $2}' | awk -F',' '{print $1}'" %(sources,name)
if os.system(cmd) == 0:
print 'process %s success' %name
else:
print 'process %s failure' %name
else:
#print name
continue
#target dir
target_dir="/tmp/"