[autologout] sre est deprecated (1)
Ignore-this: 488c77da31e3fe4ee35affde46db672c darcs-hash:20090425002600-ffbb2-dbe6f6f508fa8f99ee5e926a5794426461d340aa.gz
This commit is contained in:
parent
49e39e4a85
commit
03a5000843
1 changed files with 4 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
|||
#! /usr/bin/env python
|
||||
|
||||
import sre, commands
|
||||
import re, commands
|
||||
import crans.utils.logs
|
||||
log = crans.utils.logs.getFileLogger('autologout')
|
||||
|
||||
|
@ -8,7 +8,7 @@ log = crans.utils.logs.getFileLogger('autologout')
|
|||
for w in commands.getoutput("w -h").split('\n') :
|
||||
if not w : continue
|
||||
# on splite
|
||||
w = sre.split(' *', w)
|
||||
w = w.split()
|
||||
|
||||
if w[0] in ['cohen','segaud']:
|
||||
continue
|
||||
|
@ -19,11 +19,11 @@ for w in commands.getoutput("w -h").split('\n') :
|
|||
continue
|
||||
|
||||
# on verifie qu'on a depase le timeout
|
||||
if sre.match('^\d*\.\d*s$',w[4]) or sre.match('^[0-4]:\d*m$',w[4]) :
|
||||
if re.match('^\d*\.\d*s$', w[4]) or re.match('^[0-4]:\d*m$', w[4]) :
|
||||
continue
|
||||
|
||||
# on reccuperre les processus s le tty
|
||||
ps = sre.split(' *', commands.getoutput('ps auwwx | grep "%s" | head -n 1' % w[1] ) )
|
||||
ps = commands.getoutput('ps auwwx | grep "%s" | head -n 1' % w[1] ).split()
|
||||
|
||||
# on verrifie que c'est le bon user
|
||||
if ps[0] != w[0] :
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue