[locks] Création d'une nouvelle gestion de locks.

J'ai pas mal regardé le travail d'adg, certains trucs ne me convenaient
pas dans la gestion, du coup j'ai réécrit un truc, qui me semble
mieux.

J'ai laissé la licence telle quelle, mais j'ai mis mon nom en author
This commit is contained in:
Pierre-Elliott Bécue 2013-03-09 19:55:21 +01:00
parent c288f2b60b
commit 924f5c0684
2 changed files with 133 additions and 104 deletions

View file

@ -29,11 +29,19 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import calendar, netaddr, re, time, smtplib, sys
import calendar
import netaddr
import re
import time
import smtplib
import sys
import os
sys.path.append('/usr/scripts/gestion')
import config
from unicodedata import normalize
DEVNULL = open(os.devnull, 'w')
def ip4_of_rid(rid):
"""Convertit un rid en son IP associée"""
# Au cas où
@ -180,6 +188,13 @@ def ldap_sanitize(s):
try: return replace[c]
except KeyError: return c
return "".join([conv(c) for c in s])
def process_status(pid):
"""
Vérifie l'état du processus pid
"""
cmd = subprocess.check(['ps', '%s' % pid], stdout=DEVNULL, stderr=subprocess.STDOUT)
if cmd != 0:
return False
else:
return True