Esempio n. 1
0
def init():
    configfile = assistant.SF("%s/filecrawler.conf" %
                              (os.path.dirname(__file__)))
    print os.path.dirname(__file__)
    config = pysmartac.configer.openconfiger(configfile)

    #configer
    conf.pidfile = config.getstr("system", "pidfile", conf.pidfile)
    conf.threadCount = config.getint("system", "threadCount", conf.threadCount)
    conf.logLevel = config.getstr("system", "logLevel", conf.logLevel)
    conf.ftpServerMovieSource = config.getstr("system", "ftpServerMovieSource",
                                              conf.ftpServerMovieSource)
    conf.ftpServerAppSource = config.getstr("system", "ftpServerAppSource",
                                            conf.ftpServerAppSource)
    conf.ftpServerUser = config.getstr("system", "ftpServerUser",
                                       conf.ftpServerUser)
    conf.ftpServerPwd = config.getstr("system", "ftpServerPwd",
                                      conf.ftpServerPwd)
    conf.ftpJsonOutputPath = config.getstr("system", "ftpJsonOutputPath",
                                           conf.ftpJsonOutputPath)
    conf.movieOutputFile = config.getstr("system", "movieOutputFile",
                                         conf.movieOutputFile)
    conf.appOutputFile = config.getstr("system", "appOutputFile",
                                       conf.appOutputFile)
    conf.checkInterval = config.getint("system", "checkInterval",
                                       conf.checkInterval)
    config.save()
    #log settings
    PLOG.setlevel(conf.logLevel)
    PLOG.enableFilelog(
        assistant.SF("%s/log/FLCRAWLER_$(Date8)_$(filenumber2).log" %
                     (os.path.dirname(__file__))))
Esempio n. 2
0
def init():
    configfile = assistant.SF("%s/filecrawler.conf" %
                              (os.path.dirname(__file__)))
    print os.path.dirname(__file__)
    config = pysmartac.configer.openconfiger(configfile)

    #configer
    conf.pidfile = config.getstr("system", "pidfile", conf.pidfile)
    conf.threadCount = config.getint("system", "threadCount", conf.threadCount)
    conf.logLevel = config.getstr("system", "logLevel", conf.logLevel)
    conf.httpServerSite = config.getstr("system", "httpserversite",
                                        conf.httpServerSite)
    conf.movieDir = config.getstr("system", "movieDir", conf.movieDir)
    conf.appDir = config.getstr("system", "appDir", conf.appDir)
    conf.movieOutputFile = config.getstr("system", "movieOutputFile",
                                         conf.movieOutputFile)
    conf.appOutputFile = config.getstr("system", "appOutputFile",
                                       conf.appOutputFile)
    conf.checkInterval = config.getint("system", "checkInterval",
                                       conf.checkInterval)
    config.save()
    #log settings
    PLOG.setlevel(conf.logLevel)
    PLOG.enableFilelog("%s/log/FLCRAWLER_$(Date8)_$(filenumber2).log" %
                       (os.path.dirname(__file__)))
Esempio n. 3
0
def init():    
    configfile=assistant.SF("%s/radiusCheck.conf"%(os.path.dirname(__file__)))
    print os.path.dirname(__file__)
    config=pysmartac.configer.openconfiger(configfile)

    #configer
    conf.logLevel=config.getstr("system","logLevel",conf.logLevel)
    conf.clientPath=config.getstr("system","clientPath",conf.clientPath)
    conf.logDir=config.getstr("system","logDir",conf.logDir)
    conf.radiusIP=config.getstr("system","radiusIP",conf.radiusIP)
    conf.reponseTimeout=config.getint("system","reponseTimeout",conf.reponseTimeout)
    conf.secret=config.getstr("system","secret",conf.secret)
    config.save()
    #log settings
    PLOG.setlevel(conf.logLevel)
    PLOG.enableFilelog("%s/log/RADCK_$(Date8).log"%(os.path.dirname(__file__)))
Esempio n. 4
0
def init():    
    configfile=assistant.SF("%s/filecrawler.conf"%(os.path.dirname(__file__)))
    print os.path.dirname(__file__)
    config=pysmartac.configer.openconfiger(configfile)

    #configer
    conf.logLevel=config.getstr("system","logLevel",conf.logLevel)
    conf.httpServerSite=config.getstr("system","httpserversite",conf.httpServerSite)
    conf.movieDir=config.getstr("system","movieDir",conf.movieDir)
    conf.iosDir=config.getstr("system","iosDir",conf.iosDir)
    conf.androidDir=config.getstr("system","androidDir",conf.androidDir)
    conf.movieOutputFile=config.getstr("system","movieOutputFile",conf.movieOutputFile)
    conf.iosOutputFile=config.getstr("system","iosOutputFile",conf.iosOutputFile) 
    conf.androidOutputFile=config.getstr("system","androidOutputFile",conf.androidOutputFile) 
    config.save()
    #log settings
    PLOG.setlevel(conf.logLevel)
    PLOG.enableFilelog("%s/log/FLCRAWLER_$(Date8)_$(filenumber2).log"%(os.path.dirname(__file__)))
def init():    
    configfile=assistant.SF("%s/filecrawler.conf"%(os.path.dirname(__file__)))
    print os.path.dirname(__file__)
    config=pysmartac.configer.openconfiger(configfile)

    #configer
    conf.pidfile=config.getstr("system","pidfile",conf.pidfile)
    conf.threadCount=config.getint("system","threadCount",conf.threadCount)
    conf.logLevel=config.getstr("system","logLevel",conf.logLevel)
    conf.httpServerSite=config.getstr("system","httpserversite",conf.httpServerSite)
    conf.movieDir=config.getstr("system","movieDir",conf.movieDir)
    conf.appDir=config.getstr("system","appDir",conf.appDir)
    conf.movieOutputFile=config.getstr("system","movieOutputFile",conf.movieOutputFile)
    conf.appOutputFile=config.getstr("system","appOutputFile",conf.appOutputFile)    
    conf.checkInterval=config.getint("system","checkInterval",conf.checkInterval)
    config.save()
    #log settings
    PLOG.setlevel(conf.logLevel)
    PLOG.enableFilelog("%s/log/FLCRAWLER_$(Date8)_$(filenumber2).log"%(os.path.dirname(__file__)))
Esempio n. 6
0
def init():
    configfile = assistant.SF("%s/radiusCheck.conf" %
                              (os.path.dirname(__file__)))
    print os.path.dirname(__file__)
    config = pysmartac.configer.openconfiger(configfile)

    #configer
    conf.logLevel = config.getstr("system", "logLevel", conf.logLevel)
    conf.clientPath = config.getstr("system", "clientPath", conf.clientPath)
    conf.logDir = config.getstr("system", "logDir", conf.logDir)
    conf.radiusIP = config.getstr("system", "radiusIP", conf.radiusIP)
    conf.reponseTimeout = config.getint("system", "reponseTimeout",
                                        conf.reponseTimeout)
    conf.secret = config.getstr("system", "secret", conf.secret)
    config.save()
    #log settings
    PLOG.setlevel(conf.logLevel)
    PLOG.enableFilelog("%s/log/RADCK_$(Date8).log" %
                       (os.path.dirname(__file__)))
def init():
    configfile = assistant.SF("%s/filecrawler.conf" % (os.path.dirname(__file__)))
    print os.path.dirname(__file__)
    config = pysmartac.configer.openconfiger(configfile)

    # configer
    conf.pidfile = config.getstr("system", "pidfile", conf.pidfile)
    conf.threadCount = config.getint("system", "threadCount", conf.threadCount)
    conf.logLevel = config.getstr("system", "logLevel", conf.logLevel)
    conf.ftpServerMovieSource = config.getstr("system", "ftpServerMovieSource", conf.ftpServerMovieSource)
    conf.ftpServerAppSource = config.getstr("system", "ftpServerAppSource", conf.ftpServerAppSource)
    conf.ftpServerUser = config.getstr("system", "ftpServerUser", conf.ftpServerUser)
    conf.ftpServerPwd = config.getstr("system", "ftpServerPwd", conf.ftpServerPwd)
    conf.ftpJsonOutputPath = config.getstr("system", "ftpJsonOutputPath", conf.ftpJsonOutputPath)
    conf.movieOutputFile = config.getstr("system", "movieOutputFile", conf.movieOutputFile)
    conf.appOutputFile = config.getstr("system", "appOutputFile", conf.appOutputFile)
    conf.checkInterval = config.getint("system", "checkInterval", conf.checkInterval)
    config.save()
    # log settings
    PLOG.setlevel(conf.logLevel)
    PLOG.enableFilelog(assistant.SF("%s/log/FLCRAWLER_$(Date8)_$(filenumber2).log" % (os.path.dirname(__file__))))
Esempio n. 8
0
import tornado.websocket
import json
import sys
import pysmartac
import pysmartac.assistant as assistant
from pysmartac.daemon import daemon
from pysmartac.log import PLOG
import datetime
import threading
import uuid

lastpageuri = "file:///E:/PythonCode/ExchangeDemo/websocketA.html"
port = 8888

#log settings
PLOG.setlevel('D')
PLOG.enableFilelog("%s/log/Demo_$(Date8)_$(filenumber2).log"%(os.path.dirname(__file__)))

reload(sys)
sys.setdefaultencoding("utf-8")

def HandleSetURI(uri):
    res = {}
    res["msgid"] = "setpage"
    res["uri"] = uri
    jsres = json.dumps(res)
    for wsname,ws in WSManager.websockets.items():    
        ws.write_message(jsres)

class BaseHandler(tornado.web.RequestHandler):
    def get_current_user(self):
Esempio n. 9
0
import serial
import sys,os
import time
import json
import websocket
import thread
import pysmartac
import pysmartac.assistant as assistant
from pysmartac.daemon import daemon
from pysmartac.log import PLOG


#log settings
PLOG.setlevel('D')
PLOG.enableFilelog("%s/log/Rocker_$(Date8)_$(filenumber2).log"%(os.path.dirname(__file__)))

default_encoding = 'utf-8'
if sys.getdefaultencoding() != default_encoding:
    reload(sys)
    sys.setdefaultencoding(default_encoding)
    
ser = serial.Serial('COM6',9600, timeout=1)
###################ws 相关全局变量##############
ws = None
logined = False
###################ws 相关全局变量##############

admissibleError = 15
lastSendTime = 0
lastActive = ""
#----------------------------------------------------------------------
Esempio n. 10
0
        print(
            "没有结束统计时间,默认统计至今天(包括今天),想要统计特定日期内的数据,请输入起始和结束时间(包含起始日期和结束日期),例如:20150210 20150224"
        )
        startdate = datetime.datetime.strptime(sys.argv[1], '%Y%m%d')
        enddate = enddate + datetime.timedelta(days=1)
    else:
        try:
            startdate = datetime.datetime.strptime(sys.argv[1], '%Y%m%d')
            enddate = datetime.datetime.strptime(
                sys.argv[2], '%Y%m%d') + datetime.timedelta(days=1)
        except:
            print("输入时间参数解析失败,参数格式不对,例:20150210")
            sys.exit(1)
    PLOG.enableControllog(False)
    PLOG.enableFilelog("%s/log/SARPT_$(Date8)_$(filenumber2).log" %
                       (os.path.dirname(__file__)))
    loadconfig()
    PLOG.setlevel(SAPeakDataPublic.st.loglevel)
    # 加载基础数据,建立区域关系
    stopsCentor = SAStopDefine.stopDc
    if not stopsCentor.reloadStop():
        PLOG.error("加载站点基础数据失败!")
        sys.exit(1)
    while startdate < enddate:
        # 站点天数组数据重置
        for stopid, stop in stopsCentor.stops.items():
            stop.resetdata()
        # 统计startdate当天数据
        statisticsCurrentDayData(startdate)
        startdate = startdate + datetime.timedelta(days=1)
Esempio n. 11
0
        print ("没有输入起始和结束统计时间,默认只统计昨天数据,想要统计特定日期内的数据,请输入起始和结束时间(包含起始日期和结束日期),例如:20150210 20150224")
    elif len(sys.argv)>=2 and len(sys.argv)<3:
        print ("没有结束统计时间,默认统计至今天(包括今天),想要统计特定日期内的数据,请输入起始和结束时间(包含起始日期和结束日期),例如:20150210 20150224")
        startdate=datetime.datetime.strptime(sys.argv[1], '%Y%m%d')
        enddate=enddate+datetime.timedelta(days=1)
    else:
        try:           
            startdate=datetime.datetime.strptime(sys.argv[1], '%Y%m%d')
            enddate=datetime.datetime.strptime(sys.argv[2], '%Y%m%d')+datetime.timedelta(days=1)
        except:
            print ("输入时间参数解析失败,参数格式不对,例:20150210")
            sys.exit(1)  
    PLOG.enableControllog(False)
    PLOG.enableFilelog("%s/log/SARPT_$(Date8)_$(filenumber2).log"%(os.path.dirname(__file__)))
    loadconfig()
    PLOG.setlevel(SAPeakDataPublic.st.loglevel)
    # 加载基础数据,建立区域关系
    stopsCentor=SAStopDefine.stopDc
    if not stopsCentor.reloadStop():
        PLOG.error("加载站点基础数据失败!")
        sys.exit(1) 
    while startdate<enddate:
        # 站点天数组数据重置
        for stopid,stop in stopsCentor.stops.items():
            stop.resetdata()
        # 统计startdate当天数据
        statisticsCurrentDayData(startdate)
        startdate = startdate + datetime.timedelta(days=1)