Example #1
0
if len(opts) == 0:
    mode = 'ini'


if not targetdev:
    print '\nTarget device not specified.\n\n%s' % usage
    print '\n Run\n\t%s --device HELP\n to get possible devices names.\n' % sys.argv[0]
    sys.exit(1)


#
# Working:
#

cw = configWorker.configWorker('config.ini')

alldevs = [
        commonFuncs.cleanHostdirName ( h.hostname )
            for h in cw.hosts
    ]


if targetdev not in alldevs:
    # print them sorted:
    alldevs.sort()
    if not targetdev in ('HELP', 'ALL'):
        # nor HELP, neither ALL:
        print 'No such device: %s.' % targetdev 
    elif targetdev == 'HELP':
        # HELP:
Example #2
0
        except Exception, why:
            print 'Can not chdir to %s: %s' % (workdir, why)
            sys.exit(-1)
    else:
        workdir = os.getcwd()


    # hook signals:
    signal.signal(signal.SIGTERM, signalHandler)
    signal.signal(signal.SIGHUP, signalHandler)
    
    # start working (go to background):
    dae.startstop(dir=workdir, stdout='test.out', stderr='test.err')


    cw = configWorker.configWorker(config_ini)
    c_fd = open(cw.hostsfile)
    c_mt = os.fstat(c_fd.fileno()).st_mtime

    totPortsLock = threading.Lock()
    totalports = 0
    doReconfig = None

    #if cw.doDae == 'yes':
    #    doExit = False
    #else:
    #    doExit = True
    doExit = False

    run = 1