python批量同步web服務(wù)器代碼核心程序
更新時間:2014年09月01日 17:58:14 投稿:mdxy-dxy
這篇文章主要介紹了python批量同步web服務(wù)器代碼核心程序,需要的朋友可以參考下
#!/usr/bin/env python #coding:utf8 import os,sys import md5,tab from mysql_co.my_db import set_mysql from ssh_co.ssh_connect 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_connect.display_db() for knumber,kname,ksgin,ksize,katime,kmtime in see_file: db_file[kname]=[ksgin,ksize,katime,kmtime] for fname,fsize,fatime,fmtime in list_file: if fname in db_file.keys(): if ("%f")%fmtime == ("%f")%db_file[fname][3]: print "%s The same mtime pass"%fname my_connect.set_file_attribute(10,fname,fmtime) 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_attribute(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 main(): new_file=my_mysql() my_ssh(new_file) if __name__ == "__main__": main()
您可能感興趣的文章:
- Python Web服務(wù)器Tornado使用小結(jié)
- Python 搭建Web站點之Web服務(wù)器與Web框架
- Python基于twisted實現(xiàn)簡單的web服務(wù)器
- Python實現(xiàn)的檢測web服務(wù)器健康狀況的小程序
- Python實現(xiàn)簡易版的Web服務(wù)器(推薦)
- Python編程實現(xiàn)的簡單Web服務(wù)器示例
- Python命令啟動Web服務(wù)器實例詳解
- Python 搭建Web站點之Web服務(wù)器網(wǎng)關(guān)接口
- python探索之BaseHTTPServer-實現(xiàn)Web服務(wù)器介紹
- python快速建立超簡單的web服務(wù)器的實現(xiàn)方法
- 利用python實現(xiàn)對web服務(wù)器的目錄探測的方法
- Python Web程序搭建簡單的Web服務(wù)器
- python實現(xiàn)靜態(tài)web服務(wù)器
相關(guān)文章
Tensorflow 模型轉(zhuǎn)換 .pb convert to .lite實例
今天小編就為大家分享一篇Tensorflow 模型轉(zhuǎn)換 .pb convert to .lite實例,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2020-02-02瘋狂上漲的Python 開發(fā)者應(yīng)從2.x還是3.x著手?
熱度瘋漲的 Python,開發(fā)者應(yīng)從 2.x 還是 3.x 著手?這篇文章就為大家分析一下了Python開發(fā)者應(yīng)從2.x還是3.x學起,感興趣的小伙伴們可以參考一下2017-11-11python中字典dict排序sorted的實現(xiàn)
本文主要介紹了python中字典dict排序sorted的實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2023-05-05關(guān)于命令行執(zhí)行Python腳本的傳參方式
這篇文章主要介紹了關(guān)于命令行執(zhí)行Python腳本的傳參方式,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2022-09-09