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命令啟動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中的數(shù)據(jù)存儲模塊shelve的用法
這篇文章主要介紹了舉例簡單講解Python中的數(shù)據(jù)存儲模塊shelve的用法,shelveshelve模塊與pickle模塊的功能相近,比pickle用起來更為簡單,需要的朋友可以參考下2016-03-03
Selenium 模擬瀏覽器動態(tài)加載頁面的實(shí)現(xiàn)方法
這篇文章主要介紹了Selenium 模擬瀏覽器動態(tài)加載頁面的實(shí)現(xiàn)方法,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2018-05-05
詳解Python最長公共子串和最長公共子序列的實(shí)現(xiàn)
這篇文章主要介紹了詳解Python最長公共子串和最長公共子序列的實(shí)現(xiàn)。小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2018-07-07
python使用gdal對shp讀取,新建和更新的實(shí)例
這篇文章主要介紹了python使用gdal對shp讀取,新建和更新的實(shí)例,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2020-03-03
PyCharm取消波浪線、下劃線和中劃線的實(shí)現(xiàn)
這篇文章主要介紹了PyCharm取消波浪線、下劃線和中劃線的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-03-03
Python實(shí)現(xiàn)視頻字幕時(shí)間軸格式轉(zhuǎn)換的示例
本文主要介紹了Python實(shí)現(xiàn)視頻字幕時(shí)間軸格式轉(zhuǎn)換的示例,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2023-11-11
Python list列表中刪除多個(gè)重復(fù)元素操作示例
這篇文章主要介紹了Python list列表中刪除多個(gè)重復(fù)元素操作,結(jié)合實(shí)例形式分析了Python刪除list列表重復(fù)元素的相關(guān)操作技巧與注意事項(xiàng),需要的朋友可以參考下2019-02-02

