python批量同步web服務(wù)器代碼核心程序
更新時(shí)間: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站點(diǎn)之Web服務(wù)器與Web框架
- Python基于twisted實(shí)現(xiàn)簡單的web服務(wù)器
- Python實(shí)現(xiàn)的檢測web服務(wù)器健康狀況的小程序
- Python實(shí)現(xiàn)簡易版的Web服務(wù)器(推薦)
- Python編程實(shí)現(xiàn)的簡單Web服務(wù)器示例
- Python命令啟動(dòng)Web服務(wù)器實(shí)例詳解
- Python 搭建Web站點(diǎn)之Web服務(wù)器網(wǎng)關(guān)接口
- python探索之BaseHTTPServer-實(shí)現(xiàn)Web服務(wù)器介紹
- python快速建立超簡單的web服務(wù)器的實(shí)現(xiàn)方法
- 利用python實(shí)現(xiàn)對web服務(wù)器的目錄探測的方法
- Python Web程序搭建簡單的Web服務(wù)器
- python實(shí)現(xiàn)靜態(tài)web服務(wù)器
相關(guān)文章
python字典翻轉(zhuǎn)的實(shí)現(xiàn)
本文主要介紹了python字典翻轉(zhuǎn)的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2023-05-05pytest實(shí)現(xiàn)多種調(diào)用方式
pytest是一個(gè)非常成熟的全功能的Python測試框架,本文主要介紹了pytest多種調(diào)用方式,具有一定的參考價(jià)值,感興趣的可以了解一下2023-12-12YOLOv5改進(jìn)系列之增加小目標(biāo)檢測層
yolov5出來已經(jīng)很長時(shí)間了,所以有關(guān)yolov5的一些詳細(xì)介紹在這里就不一一介紹了,下面這篇文章主要給大家介紹了關(guān)于YOLOv5改進(jìn)系列之增加小目標(biāo)檢測層的相關(guān)資料,需要的朋友可以參考下2022-09-09Tensorflow 模型轉(zhuǎn)換 .pb convert to .lite實(shí)例
今天小編就為大家分享一篇Tensorflow 模型轉(zhuǎn)換 .pb convert to .lite實(shí)例,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧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學(xué)起,感興趣的小伙伴們可以參考一下2017-11-11Python max內(nèi)置函數(shù)詳細(xì)介紹
這篇文章主要介紹了Python MAX內(nèi)置函數(shù)詳細(xì)介紹的相關(guān)資料,需要的朋友可以參考下2016-11-11python中字典dict排序sorted的實(shí)現(xiàn)
本文主要介紹了python中字典dict排序sorted的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2023-05-05關(guān)于命令行執(zhí)行Python腳本的傳參方式
這篇文章主要介紹了關(guān)于命令行執(zhí)行Python腳本的傳參方式,具有很好的參考價(jià)值,希望對大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-09-09