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("%s/log/FLCRAWLER_$(Date8)_$(filenumber2).log"%(os.path.dirname(__file__)))

if __name__ == "__main__":
    daemon = filecrawlerDaemon('/tmp/filecrawler.pid')
    if len(sys.argv) == 2:
        if 'start' == sys.argv[1]:
            daemon.start()
        elif 'stop' == sys.argv[1]:
            daemon.stop()
        elif 'restart' == sys.argv[1]:
            daemon.restart()
        elif 'run' == sys.argv[1]:
            daemon.run()
        else:
            print "Unknown command"
            sys.exit(2)
        sys.exit(0)
    else:
        print "usage: %s start|stop|restart|run" % sys.argv[0]
        sys.exit(2)

    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__))))


if __name__ == "__main__":
    daemon = filecrawlerDaemon('/tmp/filecrawler.pid')
    if len(sys.argv) == 2:
        if 'start' == sys.argv[1]:
            daemon.start()
        elif 'stop' == sys.argv[1]:
            daemon.stop()
        elif 'restart' == sys.argv[1]:
            daemon.restart()
        elif 'run' == sys.argv[1]:
            daemon.run()
        else:
            print "Unknown command"
            sys.exit(2)
        sys.exit(0)
    else:
        print "usage: %s start|stop|restart|run" % sys.argv[0]
        sys.exit(2)