On sort de la phase de test + qq details de la ligne de commande.

darcs-hash:20060527053217-68412-4f519f0de3792da5f5c679d91445f2ade2c3dec0.gz
This commit is contained in:
glondu 2006-05-27 07:32:17 +02:00
parent ab0ce3387d
commit 2547ccda39

View file

@ -7,7 +7,7 @@
derniereConnexion dans la base LDAP. derniereConnexion dans la base LDAP.
UTILISATION UTILISATION
%(prog)s action %(prog)s [action...]
ACTIONS POSSIBLES ACTIONS POSSIBLES
%(acts)s""" %(acts)s"""
@ -22,7 +22,7 @@ from socket import gethostname
from smtplib import SMTP from smtplib import SMTP
host = gethostname() host = gethostname()
debug = u'disconnect@crans.org' debug = None
mail_report = u'disconnect@crans.org' mail_report = u'disconnect@crans.org'
mail_sender = u"Comptes inactifs <disconnect@crans.org>" mail_sender = u"Comptes inactifs <disconnect@crans.org>"
template_path = '/usr/scripts/templates/comptes_inactifs.%d.txt' template_path = '/usr/scripts/templates/comptes_inactifs.%d.txt'
@ -274,6 +274,7 @@ comptes_inactifs.py
sujet, sujet,
corps, corps,
server = smtp, server = smtp,
cc = debug,
debug = debug) debug = debug)
recapitulatif = [] recapitulatif = []
@ -286,8 +287,8 @@ comptes_inactifs.py
stats[i])) stats[i]))
recapitulatif = tableau(recapitulatif, recapitulatif = tableau(recapitulatif,
titre = (u"Inscrits", u"Procmail", u"Mails", u"Nombre"), titre = (u"Inscrits", u"Forward", u"Mails", u"Nombre"),
largeur = (10, 10, 7, 8), largeur = (10, 9, 7, 8),
alignement = ('c', 'c', 'c', 'd')) alignement = ('c', 'c', 'c', 'd'))
recapitulatif += u""" recapitulatif += u"""
Total : %d Total : %d
@ -317,16 +318,16 @@ def usage():
if __name__ == '__main__': if __name__ == '__main__':
args = sys.argv[1:] args = sys.argv[1:]
if len(args) != 1: if len(args) == 0:
sys.stderr.write("Arguments incorrects\n")
usage() usage()
sys.exit(1) sys.exit(0)
commande = args[0] for commande in args:
if commande not in actions: if commande not in actions:
sys.stderr.write("Commande incorrecte : %s\n" % commande) sys.stderr.write("Commande incorrecte : %s\n" % commande)
usage() usage()
sys.exit(2) sys.exit(2)
ci = ComptesInactifs() ci = ComptesInactifs()
for commande in args:
eval('ci.do_%s()' % commande) eval('ci.do_%s()' % commande)