Merge pull request #14 from pengyao/master

exact match, thanks for pengyao
pull/15/head
蓝枫 2015-08-26 16:12:36 +08:00
commit d34ec00a3a
1 changed files with 2 additions and 2 deletions

View File

@ -90,8 +90,8 @@ def log_record(username, host):
log_file_path = os.path.join(today_connect_log_dir, log_filename)
dept_name = User.objects.get(username=username).dept.name
pid = os.getpid()
pts = os.popen("ps axu | grep %s | grep -v grep | awk '{ print $7 }'" % pid).read().strip()
ip_list = os.popen("who | grep %s | awk '{ print $5 }'" % pts).read().strip('()\n')
pts = os.popen("ps axu | awk '$2==%s{ print $7 }'" % pid).read().strip()
ip_list = os.popen("who | awk '$2==%s{ print $5 }'" % pts).read().strip('()\n')
if not os.path.isdir(today_connect_log_dir):
try: