From 38b2825491c26f827833370711bc945a79d9c6b0 Mon Sep 17 00:00:00 2001 From: gn64_jp Date: Sat, 31 Dec 2011 10:31:44 +0000 Subject: [PATCH] test dead encode killing. git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/rec10@880 4e526526-5e11-4fc0-8910-f8fd03428081 --- rec10/trunk/src/auto_process.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/rec10/trunk/src/auto_process.py b/rec10/trunk/src/auto_process.py index c235244..23d6b30 100644 --- a/rec10/trunk/src/auto_process.py +++ b/rec10/trunk/src/auto_process.py @@ -203,26 +203,30 @@ def killDeadEncode(path): rawlist = glob.glob(path + "/*.264") for fn in rawlist: if int(time.time()-os.path.getmtime(fn))>3000: - tspath=unicode(fn.replace(".264",".ts"),'utf-8') m2vpath=unicode(fn.replace(".264",".m2v"),'utf-8') x264path=fn - x264path=re.sub("\\\[","\[",x264path) + x264path=re.sub("\\[","[",x264path) x264path=re.sub("\[","\\\[",x264path) - x264path=re.sub("\\\]","\]",x264path) - x264path=re.sub("\]","\\\]",x264path) + x264path=re.sub("\\]","]",x264path) + x264path=re.sub("]","\\]",x264path) #x264path=x264path.replace("[^\\]\]","\\\]") + tspath=unicode(x264path.replace(".264",".ts"),'utf-8') + m2vpath=unicode(x264path.replace(".264",".m2v"),'utf-8') x264path=unicode(x264path,'utf-8') os.environ['LANG']="ja_JP.UTF-8" - ktmp=u"ps auxww | grep \""+x264path+u"\" | egrep -v grep | egrep -v \"sh -c\" | grep x264 | awk '{print $2}'" + ktmp=[] + ktmp.append(u"ps auxww | grep \""+x264path+u"\" | egrep -v grep | egrep -v \"sh -c\" | grep x264 | awk '{print $2}'") + ktmp.append(u"ps auxww | grep \""+tspath+u"\" | egrep -v grep | egrep -v \"sh -c\" | grep mencoder | awk '{print $2}'") + ktmp.append(u"ps auxww | grep \""+m2vpath+u"\" | egrep -v grep | egrep -v \"sh -c\" | grep ffmpeg | awk '{print $2}'") recdblist.printutf8(u"エンコード処理異常終了タスク終了") - recdblist.printutf8(ktmp) - ktmt=commands.getoutput(ktmp.encode('utf-8')) + for istr in ktmp: + recdblist.printutf8(i) + ktmt=commands.getoutput(istr.encode('utf-8')) if len(ktmt)>0: ktmt=ktmt[0] try: if int(ktmt)>0: - ktmp=u"kill -9 `"+ktmp+u"`" - #recdblist.printutf8(ktmp) + ktmp=u"kill -9 `"+istr+u"`" recdblist.printutf8(ktmp) os.system(ktmp.encode('utf-8')) except: -- 2.11.0