#!/usr/bin/env python #coding: UTF8 import os,sys import md5,tab from mysql_co.my_db import set_mysql from Ssh_co.ssh_co Nnect import sshd from ssh_co.cfg.config import ssh_message,item_path from file import FindFile def my_mysql (): Db_file ={} my_connect=set_mysql () F_file=findfile.main (Item_path) list_file=findfile.file_list (f_file) See_file=my_co nnect.display_db () for knumber,kname,ksgin,ksize,katime,kmtime in SEE_FILE:DB_FILE[KNAME]=[KSGIN,KSIZE,KATIME,KMT IME] for Fname,fsize,fatime,fmtime in List_file:if fname in Db_file.keys (): if ("%f")%fmtime = = ("%f") %DB_FILE[FNAME][3]: print "%s" Same Mtime pass%fname My_connect.set_file_attribute (10,fname,fmti Me) pass Else:print '%s different for mtime '%fname My_connect.set_file_attribute (11,fname,fmtime) else:my_connect.add_db (fname,fsize,fatime,fmtime) my_connect.set_file_attribut
E (11,fname,fmtime) Print "%s,is new file"%fname new_file=my_connect.new_db () my_connect.disconn_db () return new_file def my_ssh ( New_file): Pid_host = 1 for Host_attribute in Ssh_message:ssh_conn=sshd (host_attribute,pid_host) for File_ Name in New_file:if file_name:a=ssh_conn.put_ssh_file (file_name[1]) print a print "ssh _connect Memoryid:%s "%pid_host else:pid_host = ID (host_attribute) ssh_conn.disconn_ssh () def m Ain (): New_file=my_mysql () my_ssh (new_file) If __name__ = "__main__": Main ()