if option.stop: stop_daemon(pid_file) sys.exit() stop_dir = os.path.splitext(pid_file)[0] + '-stop' if option.stop_thread: filename = os.path.join(stop_dir, option.stop_thread) f = open(filename, 'w') f.close() print('Kill thread signal sent. See log file.') sys.exit() conf = imp.load_source('conf', conf_file) pid = demon.make_pid(pid_file) if not os.path.exists(log_dir): os.mkdir(log_dir) main_log_file = os.path.join(log_dir, 'main.log') log = demon.Log(main_log_file) if not os.path.exists(stop_dir): os.mkdir(stop_dir) listen_ports = [] ip_conf = {} allowed_ips = [] hosts = Host() # Kumpulan request logs = {} # Kumpulan log for name in conf.host: cfg = conf.host[name]
amount = source['amount'], ref_kode = source['ref_kode'], ref_nama = source['ref_nama'], tanggal = source['tanggal'], kecamatan_kd = source['kecamatan_kd'], kecamatan_nm = source['kecamatan_nm'], kelurahan_kd = source['kelurahan_kd'], kelurahan_nm = source['kelurahan_nm'], is_kota = source['is_kota'], sumber_data = source['sumber_data'], sumber_id = source['sumber_id'], ) filenm = 'import-payment' pid_file = '/var/run/%s.pid' % filenm pid = demon.make_pid(pid_file) log = demon.Log('/var/log/%s.log' % filenm) arg = sys.argv[0] c = len(sys.argv) print c #if c < 1: # print 'python import-csv [path]' # sys.exit() path = "/home/eis-data/" if c>1: path = sys.argv[1] eng_dst = create_engine(db_url_dst) eng_dst.echo=True
format(default_limit) help_pid = 'default ' + default_pid pars = OptionParser() pars.add_option('', '--limit', help=help_limit, default=default_limit) pars.add_option('', '--pid-file', default=default_pid, help=help_pid) pars.add_option('', '--stop', action='store_true') option, remain = pars.parse_args(sys.argv[1:]) pid_file = os.path.realpath(option.pid_file) if option.stop: print('Stop Daemon') stop_daemon(pid_file) sys.exit() make_pid(pid_file) limit = int(option.limit) engine = create_engine(db_url) Base.metadata.bind = engine DBSession.configure(bind=engine) methods = dict() q = DBSession.query(Method) for row in q: methods[row.id] = row.nama banks = dict() q = DBSession.query(Bank) for row in q: