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] if 'active' in cfg: if not cfg['active']: continue else:
kelurahan_nm=source['kelurahan_nm'], is_kota=source['is_kota'], sumber_nm=source['sumber_nm'], sumber_id=source['sumber_id'], pokok=source['pokok'], denda=source['denda'], bunga=source['bunga'], jth_tempo=source['jth_tempo'], npwpd=source['npwpd'], ) filenm = 'import-invoice' pid_file = '/var/run/%s.pid' % filenm #pid = demon.make_pid(pid_file) log = demon.Log('/home/aagusti/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
security_code, registered_date) VALUES (:user_name, :user_password, :email, :status, :security_code, :registered_date)""") eng_dst.execute(sql, kode=source.unitkd, nama=source.unitnm, urusan_id=1, created=datetime.now(), updated=datetime.now(), disabled=0) filenm = 'import-units' pid_file = '/var/run/%s.pid' % filenm pid = demon.make_pid(pid_file) log = demon.Log('/var/log/%s.log' % filenm) eng_src = create_engine(db_url_src) eng_dst = create_engine(db_url_dst) eng_src.debug = True #sql = 'select count(*) from dbo.tblUnit' sql = 'SELECT count(*) count FROM admin.users2' q = eng_src.execute(sql) count = q.fetchone().count msg = 'Ada %d baris yang akan diselaraskan' % count print_log(msg) if count: log.info(msg) sources = get_syncs()