#! /usr/bin/env python

import os, sys, getopt
try:
    _MOBYLEHOME = os.environ['MOBYLEHOME']
except KeyError :
    os.environ['MOBYLEHOME']= "/local/bioweb/Mobyle"
    _MOBYLEHOME = os.environ['MOBYLEHOME']


if (os.path.join(_MOBYLEHOME,'Src')) not in sys.path:    
    sys.path.append(os.path.join(_MOBYLEHOME,'Src'))

from Mobyle.Utils import Mkill
from Mobyle.MobyleError import MobyleError


def usage():
    print """
    usage: mkill jobKey  ... 

    option:
        -h or --help  ... Print this message and exit.
    """



# ===== command line parser
try:
    opts, args = getopt.gnu_getopt( sys.argv[1:], "h", ["help"] )


    for option , value in opts: 

        if option in ( "-h","--help" ):
            usage()
            sys.exit( 0 )

    if not args:
        usage()
        sys.exit( 0 )
        
except getopt.GetoptError:
        usage()
        sys.exit( 0 )

# ===== killer
try:
    Mkill( args )
except MobyleError , err:
    print >> sys.stderr , err
    sys.exit( 1 )
