您好,欢迎来到爱玩科技网。
搜索
您的当前位置:首页shell脚本运行日志通用模块

shell脚本运行日志通用模块

来源:爱玩科技网


目标 实现记录SHELL执行的开始时间,结束时间,运行状态,错误信息等,以函数封装日志记录的方式,脚本调用函数 源码 通用函数脚本program_log_new.sh function init_log(){sqlplus -S test/passw0rd@orcl EOFinsert into program_log values($id,$day,$1, s

目标

实现记录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 //发生异常,调用异常,程序退出

Copyright © 2019- aiwanbo.com 版权所有 赣ICP备2024042808号-3

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务