Page MenuHomec4science

alertengine.wml
No OneTemporary

File Metadata

Created
Sun, Jul 21, 06:18

alertengine.wml

## $Id$
## Alert engine command line interface
## This file is part of the CERN Document Server Software (CDSware).
## Copyright (C) 2002 CERN.
##
## The CDSware is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later version.
##
## The CDSware is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with CDSware; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##read config variables
#include "config.wml"
#include "configbis.wml"
#include "cdswmllib.wml"
## start Python:
<protect>#!</protect><PYTHON>
<protect>## $Id$ </protect>
<protect>## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES.</protect>
"""Alert engine command line interface"""
__version__ = "<: print generate_pretty_version_string('$Id$'); :>"
## fill config variables:
pylibdir = "<LIBDIR>/python"
## rest of the Python code goes below
try:
import sys
sys.path.append('%s' % pylibdir)
import getopt
from cdsware.config import version, supportemail
from cdsware.alert_engine import run_alerts
from time import time
except ImportError, e:
print "Error: %s" % e
import sys
sys.exit(1)
DEBUGLEVEL = 0
def usage():
print """Usage: alertengine [OPTION]
Run the alert engine.\n
-h, --help display this help and exit
-V, --version output version information and exit\n
Report bugs to <%s>""" % supportemail
def main():
global DEBUGLEVEL
try:
opts, args = getopt.getopt(sys.argv[1:], "hV", ["help", "version"])
except getopt.GetoptError:
usage()
sys.exit(2)
for o, a in opts:
if o in ("-h", "--help"):
usage()
sys.exit()
if o in ("-V", "--version"):
print __version__
sys.exit(0)
run_alerts()
if __name__ == "__main__":
t0 = time()
main()
t1 = time()
print 'Alert engine finished in %.2f seconds' % (t1 - t0)

Event Timeline