On met le vritable possesseur et pas root.
darcs-hash:20041003143236-41617-e4bfd8359cb57c0ad9e999b892d365c956ecc4d2.gz
This commit is contained in:
parent
3940d834b2
commit
6c454d6b2b
1 changed files with 5 additions and 3 deletions
|
@ -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 ) :
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue