1 Star 0 Fork 3

流风一剑1990/DBAS

forked from 春秋/DBAS 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
TaskRun.pyw 1.46 KB
一键复制 编辑 原始数据 按行查看 历史
春秋 提交于 2015-09-09 16:16 . DBAS
# coding:utf-8
import os
import argparse
import sys
import traceback
import logging
import config
import backupdb
Parse = argparse.ArgumentParser()
Parse.add_argument('-t', nargs='?')
Args = Parse.parse_args()
logging.basicConfig(format="%(asctime)s [%(levelname)s] [%(filename)s] %(message)s",
filename=os.path.split(os.path.realpath(__file__))[0] + "/Log/Error.log")
Config = config.Config()
try:
TK = Config.Show_Tk_Info(Args.t)
if TK:
DbLinkList = TK['dl'].split('-')
for DbLink in DbLinkList:
DbLink = Config.Show_Db_Link(DbLink)
if DbLink:
backupdb.BackupMyDb(Host=DbLink['host'],
User=DbLink['user'],
Password=DbLink['password'],
DbName=DbLink['database'],
Encoding=DbLink['encode'],
Port=DbLink['port']).Backup()
else:
File = open(os.path.split(os.path.realpath(__file__))[0] + "/Log/Fail.log", 'a')
print("不存在的计划任务:{0}".format(Args.t), file=File)
File.close()
except Exception as E:
E_Type, E_Value, E_TB = sys.exc_info()
Trace_FileName, Trace_LineNo, Trace_FunName, Trace_Source = traceback.extract_tb(E_TB)[0]
logging.error("[File:{0}] [LineNo:{1}] [Mes:{2}] [Source:{3}]".format(Trace_FileName, Trace_LineNo, E_Value, Trace_Source))
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/liufengyijian/DBAS.git
git@gitee.com:liufengyijian/DBAS.git
liufengyijian
DBAS
DBAS
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385