文件: resend.sh
路径:$HOME/ggscript/ggdef
功能:该脚本为用于应对目标端因为定义文件失效导致的进程异常中断所设计
因源端业务经常未通知目标端以及系统组自行修改表结构
因此设计该脚本自动生成定义文件,并发送至指定目标机器的相应路径,以用于目标机器REPLICATE进程的正常读取
日志路径:$HOME/gglog/ggupload
#!/bin/bash cd $HOME if [ -f .profile ];then . .profile fi if [ -f .bash_profile ];then . .bash_profile fi if [ $# -eq 0 ]; then echo "info defprm" exit 2 fi mydate=`date +20%y-%m-%d-%H:%M` filename=$1 cd $HOME/ggserver/dirdef if [ ! -d bak ];then mkdir bak && echo "Directory bak created." || echo "Error: Failed to create directory $dr." else echo "bak directory exits!" fi cd $HOME/ggserver/dirprm if [ ! -e $filename ];then echo "the file is not exist!" exit 2 fi cat $filename > $HOME/ggscript/ggdef/temp defsfile=`cat $HOME/ggscript/ggdef/temp |grep DEFSFILE|cut -d ‘/‘ -f 3` target=`cat $HOME/ggscript/ggdef/temp |grep TARGET:|cut -d ‘:‘ -f 2` release=`cat $HOME/ggscript/ggdef/temp |grep RELEASE:|cut -d ‘:‘ -f 2` echo $defsfile $target $release cd $HOME/ggserver/dirdef if [ -d `$defsfile` ];then mv $defsfile bak/$defsfile fi cd $HOME/ggserver if [ "$release" == "10.4" ];then $HOME/gg104/defgen paramfile $HOME/ggserver/dirprm/$filename else ./defgen paramfile $HOME/ggserver/dirprm/$filename fi cd $HOME/ggserver/dirdef echo $target $defsfile size=`cat $defsfile| wc -c` echo $size #exec /bin/bash $HOME/ggscript/ggupload/upload.sh $target $HOME/ggserver/dirdef/$defsfile sysinfo if [ $size -le 1000 ];then exit 2 else /bin/bash $HOME/ggscript/ggupload/upload.sh $target $HOME/ggserver/dirdef/$defsfile sysinfo fi
时间: 2024-12-15 17:58:58