From a7904a8d57a84e1b554f89d8967c6085184932c2 Mon Sep 17 00:00:00 2001 From: ibuler Date: Tue, 11 Nov 2014 17:29:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E4=BA=9Bbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webroot/AutoSa/AutoSa/views.py | 8 ++++++-- webroot/AutoSa/log_handler.py | 2 +- webroot/AutoSa/runserver | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/webroot/AutoSa/AutoSa/views.py b/webroot/AutoSa/AutoSa/views.py index 80c8925dc..d258b2e19 100644 --- a/webroot/AutoSa/AutoSa/views.py +++ b/webroot/AutoSa/AutoSa/views.py @@ -290,7 +290,11 @@ def downKey(request): username = request.GET.get('username') filename = '%s/%s' % (rsa_dir, username) - f = open(filename) + try: + f = open(filename) + except IOError: + error = u'密钥文件不存在' + return render_to_response('info.html', {'error': error}) data = f.read() f.close() response = HttpResponse(data, content_type='application/octet-stream') @@ -1120,7 +1124,7 @@ def killSession(request): if pid: pid = pid[0] os.kill(pid.cpid, 9) - return HttpResponse('ok') + return render_to_response('info.html', {'msg': u'结束会话成功,返回中.'}) diff --git a/webroot/AutoSa/log_handler.py b/webroot/AutoSa/log_handler.py index 769ac65d3..f84ab7bbe 100755 --- a/webroot/AutoSa/log_handler.py +++ b/webroot/AutoSa/log_handler.py @@ -24,7 +24,7 @@ def log_hanler(logid): ret2 = os.system('cat %s | grep "\[.*@.*\][\$\#]" >> %s.his' % (filename, filename)) ret3 = os.system('cat %s | grep "EndTime" >> %s.his' % (filename, filename)) if (ret1 + ret2 + ret3) == 0: - print 'Handler % ok.' % filename + print 'Handler %s ok.' % filename def set_finish(id): diff --git a/webroot/AutoSa/runserver b/webroot/AutoSa/runserver index e716b1845..2bee5c224 100755 --- a/webroot/AutoSa/runserver +++ b/webroot/AutoSa/runserver @@ -1,3 +1,4 @@ #!/bin/bash -./manage.py runserver 0.0.0.0:80 +./manage.py runserver 0.0.0.0:80 &> access.log & +./log_handler.py &> handler.log &