diff --git a/gestion/lock.py b/gestion/lock.py index 2b532653..3a992c45 100755 --- a/gestion/lock.py +++ b/gestion/lock.py @@ -9,6 +9,7 @@ Licence : GPLv2 import os,string,time,sys, affich_tools from commands import getoutput +from user_tests import getuser def make_lock(lock_name, lock_comment='',nowait=1) : """ Création d'un lock @@ -21,6 +22,7 @@ def make_lock(lock_name, lock_comment='',nowait=1) : # Lecture du lock fd = open(lock_file, "r") pid= fd.readline().strip() + user = fd.readline().strip() fd.close() # Informations sur le processus lockant @@ -29,8 +31,8 @@ def make_lock(lock_name, lock_comment='',nowait=1) : os.remove(lock_file) elif nowait : sys.stderr.write('Lock : %s\n' % lock_file) - l=getoutput('ps -o user,pid,etime --no-headers %s' % pid) - data = l.split() + l=getoutput('ps -o etime --no-headers %s' % pid) + data = [ user , pid , l.strip() ] # Formatate de etime s = data[-1].split('-') @@ -64,7 +66,7 @@ def make_lock(lock_name, lock_comment='',nowait=1) : ### Prise du lock lock_fd=open(lock_file, "w") - lock_fd.write("%s\n%s" % (os.getpid(), lock_comment) ) + lock_fd.write("%s\n%s\n%s" % (os.getpid(), getuser(), lock_comment) ) lock_fd.close() def remove_lock( lock_name ) :