Example #1
0
def main(argv):

    log.debug("argv ", argv, "len argv ", len(argv))

    if len(argv) == 2:

        log.info("Creating logFile %s " % logFile)
        cfgFile = argv[1]
        log.info("Loading ConfigFile %s " % cfgFile)

    else:

        log.error("USAGE : <%s> fx [args] Not enough arguments " % argv[0])
        return 1

    # Loading config files.
    rc = fu.loadConfigFile(cfgFile, ib, log)
    if rc != 0:
        log.error("Issue opening config File %s rc = %s" % (cfgFile, rc))
        return rc
    log.debug("Loaded %s " % cfgFile)

    # Set Files
    rc = getIncWildFiles()
    if rc != 0:
        log.error("Issue with source files Files rc = %s" % (rc))
        return rc
Example #2
0
    def _getConfigFile(self):
        #fn = '%s/%s.%s' % (self.ib.cfgDir, self.appName,self.suf)
        fn = '%s' % (self.ib.configFile)
        rc = fu.loadConfigFile(fn, self.ib, self.log)
        if rc == 0: self.log.info('Loading config file:%s' % fn)
        else: self.log.critical("Error Loading Config File %s" % fn)

        return rc
Example #3
0
def main(Args):

    # Set log
    fn = os.path.splitext(os.path.basename(sys.argv[0]))[0]
    logFile = getLogHandler(fn,log)
    log.info('logFile= %s' % logFile)
    
   # EO Uncomment in UNIX or set en vars in windows.                         
    rc = _getEnvVars()
    if rc != 0 :
        log.error( "Need to set all env vars:\n %s" %  infaEnvVar.keys())
        return (rc)

    rc = parseArg(sys.argv)
    log.info('userOpt = ' , userOpt)
    if rc != 0 : return(rc)
    if os.environ.has_key('CONFIG_FILE') : 
        fn = os.environ['CONFIG_FILE']
    else:
        log.error("need to set env : 'CONFIG_FILE' " )  
        return 1
    
    log.info('Loading config file:%s' % fn)
    rc = fu.loadConfigFile(fn,ib,log)
    if rc != 0 : 
        log.error('Exiting the program')
        return 1
    
    if (config) : show_config(ib)
    #print "MEMBERS ", inspect.getmembers (ib)
    # Execute program    
    if runSeq is not None and len(runSeq) > 0 : 
        rc = execSteps(runSeq)
        if rc == 0 : log.info ('Completed running execSteps')
        else       : log.error('execSteps rc = %s' % rc)

    text = 'Please see logFile %s' % logFile
    subj = "SUCCESS running %s on %s " %(fn,hostname ) if rc == 0 else "ERROR running %s on %s" % (fn,hostname)
    rc,msg=sm.sendNotif(rc,log,subj,text,[logFile,])
    log.info('Sending Notification\t%s rc = %s' % (msg,rc))
    
    sys.exit(rc)
Example #4
0
def main(argv):
    appName = os.path.splitext(os.path.basename(argv[0]))[0]
    if len(argv) != 2:
        log.error("USAGE : <%s> fx [runSeq] Incorrect Number of arguments (%d)" % (argv[0], len(argv)))
        sys.exit(1)

    runSeq = argv[1]
    logFile = getLogHandler(appName, log)
    log.info("logfile = ", logFile)

    rc = _getEnvVars()
    if rc != 0:
        log.error("Need to set all env vars:\n %s" % infaEnvVar.keys())
        sys.exit(rc)

    log.info("Loading Config File %s" % ib.configFile)
    rc = fu.loadConfigFile(ib.configFile, ib, log)
    if rc != 0:
        log.error("Cannot Load %s Exiting the program" % ib.configFile)
        return 1

    # Execute program
    if runSeq is not None and len(runSeq) > 0:
        rc = execSteps(runSeq)
        if rc == 0:
            log.info("Completed running execSteps")
        else:
            log.error("execSteps rc = %s" % rc)

    log.info("Executed cmd = ", argv[1:], " rc = ", rc)
    subj = (
        ("SUCCESS running %s on Server %s Monitoring %s " % (appName, hostname, ib.rhost))
        if rc == 0
        else ("ERROR running %s on Server %s. Monitoring %s " % (appName, hostname, ib.rhost))
    )
    text = "Running %s host=%s. Monitoring %s . Please See logfile %s" % (appName, hostname, ib.rhost, logFile)
    text += gText

    rc1, msg = sm.sendNotif(rc, log, subj, text, [logFile])
    log.info("logFile= %s" % logFile)
    log.info("Sending Notification\t%s rc = %s" % (msg, rc1))
    return rc
Example #5
0
 def _getConfigFile(self):
     fn = '%s/%s.%s' % (self.ib.cfgDir, self.appName,self.suf)
     self.log.info('Loading config file:%s' % fn)
     return fu.loadConfigFile(fn, self.ib, self.log)