您现在的位置是:主页 > news > 网站建设是一次性给钱还是什么/免费代码网站

网站建设是一次性给钱还是什么/免费代码网站

admin2025/6/24 5:12:05news

简介网站建设是一次性给钱还是什么,免费代码网站,wordpress 谷歌收录快,深圳做网站优化的公司目标 实现记录SHELL执行的開始时间&#xff0c;结束时间。执行状态&#xff0c;错误信息等&#xff0c;以函数封装日志记录的方式&#xff0c;脚本调用函数 源代码 通用函数脚本program_log_new.shfunction init_log() { sqlplus -S test/passw0rdorcl <<EOF insert into…

网站建设是一次性给钱还是什么,免费代码网站,wordpress 谷歌收录快,深圳做网站优化的公司目标 实现记录SHELL执行的開始时间&#xff0c;结束时间。执行状态&#xff0c;错误信息等&#xff0c;以函数封装日志记录的方式&#xff0c;脚本调用函数 源代码 通用函数脚本program_log_new.shfunction init_log() { sqlplus -S test/passw0rdorcl <<EOF insert into…

目标

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

源代码

通用函数脚本program_log_new.sh
function init_log()
{
sqlplus -S test/passw0rd@orcl <<EOF
insert into program_log values($id,$day,'$1', sysdate,null,'S',null);
commit
exit
EOF
}
function modify_status(){
sqlplus -S test/passw0rd@orcl <<EOF
update program_log set program_status='$1',end_date=sysdate where id=$id;
commit
exit
EOF
}function exception_write(){
if [ $? -ne 0 ]
thenmodify_status $status2
exit 1
fi
}
function finish_write(){
if [ $? -eq 0 ]
thenmodify_status $status1
#modify_status $1 $2 $3else
#  modify_status $1 $2 $3modify_status $status2
exit 1
fi
}
status1=C
status2=F
day=`date "+%Y%m%d"`
id=`sqlplus -S user/1234@test <<EOF
set heading off
select  program_log_seq.nextval from dual;
commit
exit
EOF`
#!/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                                       //发生异常,调用异常,程序退出



转载于:https://www.cnblogs.com/bhlsheji/p/5348013.html