设为首页 加入收藏

TOP

shell脚本运行日志通用模块
2014-11-24 01:03:05 来源: 作者: 【 】 浏览:7
Tags:shell 脚本 运行 日志 通用 模块

目标

实现记录SHELL执行的开始时间,结束时间,运行状态,错误信息等,以函数封装日志记录的方式,脚本调用函数

源码

通用函数脚本program_log_new.sh
function init_log()
{
sqlplus -S test/passw0rd@orcl < 
 
#!/bin/sh
. ~/.bash_profile
source program_log_new.sh    //公用脚本

init_log sh_xx                                            //初始化日志函数调用,传入程序名

shell命令xxx 2>${logdir}/xx_$time.log          
exception_write                                       //发生异常,调用异常,程序退出

shell命令xxx 2>${logdir}/xx_$time.log          
exception_write                                       //发生异常,调用异常,程序退出
....
shell命令xxx 2>${logdir}/xx_$time.log          
finish_write                                       //发生异常,调用异常,程序退出
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇存储过程运行日志记录通用模块 下一篇怎样收集EBS各个模块的Log,SQLtra..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: