Post a shell for reference

Source: Internet
Author: User

1#! /bin/Bash2deploy_path=$ (CD"$ (dirname"$0")";pwd)3ini_file= $DEPLOY _path'/cnedmp_etl.ini'4 . $INI _file5base_path=$ (CD"$ (dirname"$DEPLOY _path")";pwd)6main_path=$ (CD"$ (dirname"$BASE _path")";pwd)7Currrent_date= 'Date-U +\%y\%m\%d '8Current_time= 'Date-U +"%y%m%d%t"`9Log_path= $BASE _path'/log/'Tenrecord_file= $LOG _path'EMAILRECORD.RCD' One  A#Echo$value |sed 's/[0-9]\{1,\}/30/g' -#sed-I.'s/[0-9]\{1,\}/30/g'Test.txt -#sed-I.'S/^load_check.20170803.log.*[0-9]\{1,\}/load_check.20170803.log 178/g'EMAILRECORD.RCD the  - CD $LOG _path -Test-e $RECORD _file | |Touch$RECORD _file -  +Loglist= 'ls$LOG _path |grep "${currrent_date}.log"` -#Echo$loglist +  A  at #Use to store email cotent -Email_message="" -  for logname inch$loglist -  Do -#Echo$logname -Prc_exist= 'Cat$RECORD _file |grep "$logname"` inTest-z"${prc_exist}" -     if[$?-eq0]; Then toPrc=0 +         Echo "$logname ' cat $logname | wc-l '">>$RECORD _file -     Else thePrc= 'Echo$PRC _exist |awk-F' ' '{print $NF}'` *Nrc= 'Cat$logname|WC-l ' $         sed-I."s/^ $logname. *[0-9]\{1,\}$/$logname $NRC/g"$RECORD _filePanax Notoginseng     fi -      theTmp_message="" +Warn_message= 'Cat$logname|Tail-N +$[$PRC +1] |grep "WARN"` ATest-z"${warn_message}" the     if[$?-ne0 ] +      Then -Tmp_message="${tmp_message}warn message:\\n${warn_message}\\n" $     fi $Fatal_message= 'Cat$logname|Tail-N +$[$PRC +1] |grep "FATAL"` -Test-z"${fatal_message}" -     if[$?-ne0 ] the      Then -Tmp_message="${tmp_message}fatal message:\\n${fatal_message}\\n"Wuyi     fi theTest-z"${tmp_message}" -     if[$?-ne0 ] Wu      Then -Email_message="${email_message}\\n${logname}:\\n${tmp_message}\\n" About     fi $  Done -  -Test-z"${email_message}" - if[$?-ne0 ] A  Then +  the#/usr/sbin/sendmail"[email protected]"<<EOF -#subject: <failed job/fileEtc> $ #from: Edmpcn.etl the#"Below is WARN and FATAL: \\n"$email _message the #EOF the  theemail_log="/home/infra1/jason/workspace/logs/emaillog/""sendmail. $CURRENT _time.log" - Echo-E"Below is WARN and fatal:\\n${email_message}">$email _log in      the fi

Post a shell for reference

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.