make install UCBINSTALL=\/usr\/bin\/install<\/pre>\n
\n\u5f02\u5e38\u62a5\u9519\u89e3\u51b3\u65b9\u6cd5<\/p>\n
\u4e0b\u8f7dmailx\u8865\u4e01\u6587\u4ef6\u201cmailx-12.4-openssl_1.0.0_build_fix-1.patch\u201d\uff0c\u5c06\u8865\u4e01\u6587\u4ef6\u548cmailx\u89e3\u538b\u7f29\u76ee\u5f55\u653e\u7f6e\u540c\u4e00\u8def\u5f84
\n
\n\u6267\u884c\u6253\u8865\u4e01\u547d\u4ee4\uff1a<\/p>\n
patch -p0 < mailx-12.4-openssl_1.0.0_build_fix-1.patch<\/pre>\n
\n\u8fdb\u5165mailx-12.4\u91cd\u65b0\u6267\u884c\u7f16\u8bd1\u547d\u4ee4\uff1a<\/p>\n
make install UCBINSTALL=\/usr\/bin\/install<\/pre>\n<\/p>\n
\u68c0\u6d4bmailx\u662f\u5426\u5b89\u88c5\u6210\u529f\uff1amailx -V
\n<\/p>\n
3\u3001\u914d\u7f6e<\/strong><\/span><\/div>\n\r\nvi \/etc\/nail.rc\uff0c\u5728\u6587\u4ef6\u7684\u6700\u540e\u6dfb\u52a0\r\n\r\nset from=\r\n\r\nset smtp=\r\n\r\nset smtp-auth-user=\r\n\r\nset smtp-auth-password=\r\n\r\nset smtp-auth=login\r\n<\/pre>\n\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u4fee\u6539\u914d\u7f6e\u5b8c\u540e\u4fdd\u5b58
\n<\/p>\n
4\u3001\u6d4b\u8bd5\u53d1\u9001\u90ae\u4ef6<\/strong><\/span><\/div>\necho '\u90ae\u4ef6\u6b63\u6587'|mailx -v -s \"\u90ae\u4ef6\u6807\u9898\" \u90ae\u7bb1\u5730\u5740
\n
\n\u81f3\u6b64\u90ae\u4ef6\u529f\u80fd\u6d4b\u8bd5\u6b63\u5e38\uff0c\u63a5\u4e0b\u6765\u662f\u5173\u952e\u5b57\u76d1\u63a7\u811a\u672c\u7684\u7f16\u5199\u5de5\u4f5c\uff0c\u901a\u8fc7\u65e5\u5fd7\u5173\u952e\u5b57\u811a\u672c\u89e6\u53d1\u90ae\u4ef6\u544a\u8b66\u811a\u672c\u5b9e\u73b0\u65e5\u5fd7\u76d1\u63a7<\/p>\n
\u4e8c\u3001\u5173\u952e\u5b57\u76d1\u63a7\u811a\u672c\u5f00\u53d1<\/strong><\/div>\nCheckLogs.sh \u65e5\u5fd7\u76d1\u63a7\u7a0b\u5e8f<\/p>\n
SendMail.sh \u53d1\u90ae\u4ef6\u811a\u672c,\u8be5\u811a\u672c\u53ef\u81ea\u5b9a\u4e49<\/p>\n
conf \u914d\u7f6e\u6587\u4ef6\u76ee\u5f55,chklist\u4e3a\u914d\u7f6e\u6587\u4ef6
\n
\n\u521d\u6b21\u6267\u884cCheckLogs.sh\u811a\u672c\u4f1a\u8bfb\u53d6\u65e5\u5fd7\u6587\u4ef6\u5e76\u8bb0\u5f55\u5f53\u524d\u8bfb\u53d6\u7684\u884c\u6570
\n
\n\u540e\u7eed\u8fd0\u884c\u811a\u672c\u5219\u8bfb\u53d6\u66f4\u65b0\u65e5\u5fd7\uff0c\u4f8b\u5982\u5f53\u524d\u65e5\u5fd7\u66f4\u65b0\u4e869\u884c\u6570\u636e\uff0c\u5219\u811a\u672c\u4ece\u6700\u65b0\u76849\u884c\u6570\u636e\u83b7\u53d6\u5173\u952e\u5b57<\/p>\n
<\/p>\n
\u6d4b\u8bd5\u63d2\u5165\u5173\u952e\u5b57error
\n
\n\u7ee7\u7eed\u6267\u884c\u811a\u672c\u53ef\u4ee5\u770b\u5230\u5df2\u6355\u83b7\u5173\u952e\u5b57\u5e76\u89e6\u53d1\u544a\u8b66
\n
\n\u6d4b\u8bd5\u591a\u5173\u952e\u5b57
\n
\n\u518d\u6b21\u6267\u884c\u53ef\u4ee5\u770b\u5230\u5df2\u6355\u83b7\u6700\u65b0\u66f4\u65b0\u7684\u65e5\u5fd7\u4fe1\u606f
\n
\n\u6d4b\u8bd5\u9891\u7387\u63a7\u5236
\n
\n\u81f3\u6b64\u76f8\u5173\u529f\u80fd\u6d4b\u8bd5\u5df2\u5b8c\u6210\u3002\u6700\u540e\u9644\u4e0a\u811a\u672c\u76f8\u5173\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n
#!\/bin\/bash\r\nbasedir=$(cd `dirname \"$0\"`;pwd)\r\nlogsdir=$basedir\/logs\r\ntmpsdir=$basedir\/tmps\r\nconfdir=$basedir\/conf\r\nchkfile=$confdir\/chklist\r\nlogfile=$logsdir\/log.log_$(date +%F)\r\n\r\n#\u521b\u5efa\u5404\u79cd\u76ee\u5f55\r\nmkdir -p $logsdir $tmpsdir $confdir\r\n\r\n#\u521b\u5efa\u914d\u7f6e\u6587\u4ef6\r\nif test ! -e \"$chkfile\";then\r\n echo \"#\u65e5\u5fd7\u6587\u4ef6,\u5173\u952e\u5b57(\u591a\u5173\u952e\u5b57|\u9694\u5f00),\u91cd\u8bd5\u6b21\u6570,\u6700\u5927\u6267\u884c\u6b21\u6570,\u542f\u52a8\u547d\u4ee4,\u505c\u6b62\u547d\u4ee4\" >$chkfile\r\nfi\r\n\r\n#\u751f\u6210\u65e5\u5fd7\u51fd\u6570\r\ndo_writelog() {\r\n case $1 in\r\n i|I)\r\n shift\r\n echo \"$(date +%Y-%m-%d) $(date +%H:%M:%S)|INFO|$@\" >>$logfile\r\n ;;\r\n e|E)\r\n shift\r\n echo \"$(date +%Y-%m-%d) $(date +%H:%M:%S)|ERROR|$@\" >>$logfile\r\n ;;\r\n w|W)\r\n shift\r\n echo \"$(date +%Y-%m-%d) $(date +%H:%M:%S)|WARNING|$@\" >>$logfile\r\n ;;\r\n *)\r\n echo \"$(date +%Y-%m-%d) $(date +%H:%M:%S)|DEBUG|$@\" >>$logfile\r\n esac\r\n}\r\n\r\n#\u65e5\u5fd7\u5904\u7406\u90e8\u5206\u4ee3\u7801\r\ncat $chkfile|egrep -v \"^($|#)\"|while read i;do\r\n(\r\n app_name=$(echo \"$i\"|awk -F, '{print $1}')\r\n if test -z \"$app_name\";then\r\n do_writelog e \"\u5e94\u7528\u540d\u79f0\u4e3a\u7a7a,\u9000\u51fa\u6267\u884c\"\r\n exit 0\r\n fi\r\n log_filename=$(echo \"$i\"|awk -F, '{print $2}')\r\n if test ! -e \"$log_filename\";then\r\n do_writelog e \"\u65e5\u5fd7\u6587\u4ef6($log_filename)\u4e0d\u5b58\u5728,\u9000\u51fa\u6267\u884c\"\r\n exit 0\r\n fi\r\n log_md5sum=$(echo -n \"$log_filename\"|md5sum|awk '{print $1}')\r\n log_gjz=$(echo \"$i\"|awk -F, '{print $3}')\r\n if test -z \"$log_gjz\";then\r\n do_writelog i \"\u65e5\u5fd7\u6587\u4ef6($log_filename),\u5173\u952e\u5b57\u4e3a\u7a7a,\u9000\u51fa\u6267\u884c\"\r\n exit 0\r\n fi\r\n log_retry=$(echo \"$i\"|awk -F, '{print $4}')\r\n expr $log_retry + 0 &>\/dev\/null\r\n if [ $? -ne 0 ];then\r\n log_retry=0\r\n fi\r\n log_max=$(echo \"$i\"|awk -F, '{print $5}')\r\n expr $log_max + 0 &>\/dev\/null\r\n if [ $? -ne 0 ];then\r\n log_max=3\r\n fi\r\n start_command=$(echo \"$i\"|awk -F, '{print $6}')\r\n stops_command=$(echo \"$i\"|awk -F, '{print $7}')\r\n open_sendmail=$(echo \"$i\"|awk -F, '{print $8}')\r\n mail_scripts=$(echo \"$i\"|awk -F, '{print $9}')\r\n mail_contacts=$(echo \"$i\"|awk -F, '{print $10}')\r\n if [ $open_sendmail -eq 1 ];then\r\n if test -z \"$mail_scripts\";then\r\n do_writelog i \"\u5e94\u7528($app_name),\u89e6\u53d1\u52a8\u4f5c\u811a\u672c\u4e3a\u7a7a,\u9000\u51fa\u6267\u884c\"\r\n exit 0\r\n fi\r\n if test -z \"$mail_contacts\";then\r\n do_writelog i \"\u5e94\u7528($app_name),\u8054\u7cfb\u4eba\u4e3a\u7a7a,\u9000\u51fa\u6267\u884c\"\r\n exit 0\r\n fi\r\n fi\r\n if test ! -e \"$tmpsdir\/$log_md5sum\";then\r\n log_new_count=$(wc -l $log_filename|awk '{print $1}')\r\n echo \"$log_new_count\" >$tmpsdir\/$log_md5sum\r\n do_writelog i \"\u65e5\u5fd7\u6587\u4ef6($log_filename),\u521d\u59cb\u5316\u8bfb\u53d6\u65e5\u5fd7\u884c\u6570:$log_new_count,\u9000\u51fa\u6267\u884c\"\r\n else\r\n log_old_count=$(cat $tmpsdir\/$log_md5sum)\r\n expr $log_old_count + 0 &>\/dev\/null\r\n if [ $? -ne 0 ];then\r\n do_writelog e \"\u65e5\u5fd7\u6587\u4ef6($log_filename),\u8bfb\u53d6\u5386\u53f2\u884c\u6570\u5931\u8d25,\u9000\u51fa\u6267\u884c\"\r\n exit 0\r\n fi\r\n log_new_count=$(wc -l $log_filename|awk '{print $1}')\r\n if [ $log_new_count -eq $log_old_count ];then\r\n do_writelog i \"\u65e5\u5fd7\u6587\u4ef6($log_filename),\u672a\u66f4\u65b0,\u9000\u51fa\u6267\u884c\"\r\n exit 0\r\n elif [ $log_new_count -lt $log_old_count ];then\r\n do_writelog i \"\u65e5\u5fd7\u6587\u4ef6($log_filename),\u8de8\u65e5\u66f4\u65b0\u65e5\u5fd7\u884c\u6570:$log_new_count,\u9000\u51fa\u6267\u884c\"\r\n echo \"$log_new_count\" >$tmpsdir\/$log_md5sum\r\n else\r\n log_upd_count=$(expr $log_new_count - $log_old_count)\r\n do_writelog i \"\u65e5\u5fd7\u6587\u4ef6($log_filename),\u5386\u53f2\u884c\u6570:$log_old_count,\u6700\u65b0\u884c\u6570:$log_new_count,\u66f4\u65b0\u884c\u6570:$log_upd_count\" \r\n #\u8bfb\u53d6\u66f4\u65b0\u7684\u65e5\u5fd7\r\n log_content=$(tail -n +`expr $log_old_count + 1` $log_filename|head -n +$log_upd_count)\r\n oldIFS=$IFS\r\n IFS=\"|\"\r\n count=0\r\n for i in $log_gjz;do\r\n if [ $(echo \"$log_content\"|grep -c -w \"$i\") -ge 1 ];then\r\n let count+=1 \r\n fi\r\n if [ $count -gt 0 ];then\r\n break\r\n fi\r\n done\r\n IFS=$oldIFS\r\n if [ $count -gt 0 ];then\r\n echo \"0\" >>$tmpsdir\/${log_md5sum}.retry\r\n else\r\n do_writelog i \"\u65e5\u5fd7\u6587\u4ef6($log_filename),\u672a\u83b7\u53d6\u5230\u5173\u952e\u5b57,\u9000\u51fa\u6267\u884c\"\r\n echo \"$log_new_count\" >$tmpsdir\/$log_md5sum\r\n exit 0\r\n fi\r\n if [[ $(wc -l $tmpsdir\/${log_md5sum}.retry|awk '{print $1}') -gt $log_retry ]];then\r\n echo \"0\" >>$tmpsdir\/${log_md5sum}_$(date +%F)\r\n if [ $(wc -l $tmpsdir\/${log_md5sum}_$(date +%F)|awk '{print $1}') -le $log_max ];then\r\n $stops_command 1>>$logfile 2>&1\r\n $start_command 1>>$logfile 2>&1\r\n do_writelog i \"\u65e5\u5fd7\u6587\u4ef6($log_filename),\u65e5\u5fd7\u5185\u5bb9:$log_content,\u627e\u5230\u5173\u952e\u5b57:$i,\u505c\u6b62\u547d\u4ee4:$stops_command,\u542f\u52a8\u547d\u4ee4:$start_command,\u91cd\u542f\u670d\u52a1\"\r\n if [ $open_sendmail -eq 1 ];then\r\n if test -n \"$mail_scripts\";then\r\n $mail_scripts \"\u5e94\u7528[$app_name]\u6545\u969c\" \"\u65e5\u5fd7\u6587\u4ef6($log_filename),\u65e5\u5fd7\u5185\u5bb9:$log_content,\u627e\u5230\u5173\u952e\u5b57:$i\" \"$mail_contacts\" 1>>$logfile 2>&1\r\n if [ $? -ne 0 ];then\r\n do_writelog i \"\u65e5\u5fd7\u6587\u4ef6($log_filename),\u65e5\u5fd7\u5185\u5bb9:$log_content,\u627e\u5230\u5173\u952e\u5b57:$i,\u89e6\u53d1\u544a\u8b66\u5931\u8d25\"\r\n fi\r\n do_writelog i \"\u65e5\u5fd7\u6587\u4ef6($log_filename),\u65e5\u5fd7\u5185\u5bb9:$log_content,\u627e\u5230\u5173\u952e\u5b57:$i,\u89e6\u53d1\u544a\u8b66\u901a\u77e5\u8054\u7cfb\u4eba:[$mail_contacts]\"\r\n fi\r\n else\r\n do_writelog i \"\u65e5\u5fd7\u6587\u4ef6($log_filename),\u65e5\u5fd7\u5185\u5bb9:$log_content,\u627e\u5230\u5173\u952e\u5b57:$i,\u4e0d\u89e6\u53d1\u544a\u8b66\"\r\n fi\r\n else\r\n do_writelog i \"\u65e5\u5fd7\u6587\u4ef6($log_filename),\u65e5\u5fd7\u5185\u5bb9:$log_content,\u627e\u5230\u5173\u952e\u5b57:$i,\u91cd\u542f\u670d\u52a1\u8d85\u51fa\u5f53\u5929\u9650\u5236\u6b21\u6570:$log_max,\u9000\u51fa\u6267\u884c\"\r\n fi\r\n rm -f $tmpsdir\/${log_md5sum}.retry &>\/dev\/null\r\n else\r\n do_writelog i \"\u65e5\u5fd7\u6587\u4ef6($log_filename),\u65e5\u5fd7\u5185\u5bb9:$log_content,\u627e\u5230\u5173\u952e\u5b57:$i,\u91cd\u8bd5\u68c0\u6d4b:$(wc -l $tmpsdir\/${log_md5sum}.retry|awk '{print $1}')\"\r\n fi\r\n echo \"$log_new_count\" >$tmpsdir\/$log_md5sum\r\n do_writelog i \"\u65e5\u5fd7\u6587\u4ef6($log_filename),\u66f4\u65b0\u8bb0\u6b21\u6587\u4ef6\u5b8c\u6210\" \r\n fi\r\n fi\r\n)&\r\ndone<\/pre>\n","protected":false},"excerpt":{"rendered":"tar -jxf mailx-12.4.tar.bz2 -C \/usr\/src\/ && cd […]<\/p>\n","protected":false},"author":1469,"featured_media":198354,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-198335","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/198335","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/1469"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=198335"}],"version-history":[{"count":7,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/198335\/revisions"}],"predecessor-version":[{"id":198469,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/198335\/revisions\/198469"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/198354"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=198335"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=198335"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=198335"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}