{"id":72586,"date":"2026-02-06T04:56:58","date_gmt":"2026-02-05T20:56:58","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/72586.html"},"modified":"2026-02-06T04:56:58","modified_gmt":"2026-02-05T20:56:58","slug":"7%e4%b8%aashell%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%b7%a1%e6%a3%80%e8%84%9a%e6%9c%ac%ef%bd%9c%e6%96%b0%e6%89%8b%e7%9b%b4%e6%8e%a5%e5%a4%8d%e5%88%b6%e5%8f%af%e7%94%a8%ef%bc%88%e9%99%84%e8%af%a6%e7%bb%86","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/72586.html","title":{"rendered":"7\u4e2aShell\u670d\u52a1\u5668\u5de1\u68c0\u811a\u672c\uff5c\u65b0\u624b\u76f4\u63a5\u590d\u5236\u53ef\u7528\uff08\u9644\u8be6\u7ec6\u6b65\u9aa4\uff09"},"content":{"rendered":"<p>\u672c\u6587\u6574\u7406\u4e867\u4e2a\u751f\u4ea7\u7ea7Shell\u5de1\u68c0\u811a\u672c&#xff0c;\u8986\u76d6\u7cfb\u7edf\u5065\u5eb7\u3001\u78c1\u76d8\u3001\u7f51\u7edc\u3001\u8fdb\u7a0b\u3001\u5b89\u5168\u3001\u6570\u636e\u5e93\u3001\u6279\u91cf\u5de1\u68c0\u573a\u666f\u3002\u6bcf\u4e2a\u811a\u672c\u90fd\u6807\u6ce8\u4e86\u914d\u7f6e\u4fee\u6539\u70b9\u3001\u4f7f\u7528\u6b65\u9aa4\u548c\u65b0\u624b\u907f\u5751\u63d0\u793a&#xff0c;\u590d\u5236\u4ee3\u7801\u5c31\u80fd\u7528&#xff0c;\u9002\u5408\u8fd0\u7ef4\u65b0\u624b\u5feb\u901f\u4e0a\u624b\u3002<\/p>\n<h3>\u811a\u672c\u603b\u89c8&#xff1a;\u6309\u9700\u6c42\u9009\u811a\u672c<\/h3>\n<table>\n<tr>\u811a\u672c\u5e8f\u53f7\u811a\u672c\u540d\u79f0\u6838\u5fc3\u7528\u9014\u9002\u7528\u573a\u666f<\/tr>\n<tbody>\n<tr>\n<td>1<\/td>\n<td>\u7cfb\u7edf\u5065\u5eb7\u68c0\u67e5\u811a\u672c<\/td>\n<td>\u68c0\u67e5CPU\u3001\u5185\u5b58\u3001\u78c1\u76d8\u3001\u7f51\u7edc\u3001\u8fdb\u7a0b\u7b49\u57fa\u7840\u8d44\u6e90<\/td>\n<td>\u65e5\u5e38\u670d\u52a1\u5668\u5065\u5eb7\u5de1\u68c0&#xff08;\u6bcf\u59291\u6b21&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>\u78c1\u76d8\u7a7a\u95f4\u6df1\u5ea6\u68c0\u67e5\u811a\u672c<\/td>\n<td>\u5b9a\u4f4d\u5927\u6587\u4ef6\u3001\u65e5\u5fd7\u5806\u79ef\u3001Inode\u5360\u7528\u95ee\u9898<\/td>\n<td>\u78c1\u76d8\u6ee1\u9884\u8b66\u3001\u6e05\u7406\u524d\u5206\u6790<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>\u7f51\u7edc\u8fde\u63a5\u68c0\u67e5\u811a\u672c<\/td>\n<td>\u68c0\u67e5\u7aef\u53e3\u76d1\u542c\u3001TCP\u8fde\u63a5\u3001\u7f51\u7edc\u8fde\u901a\u6027<\/td>\n<td>\u7f51\u7edc\u6545\u969c\u6392\u67e5\u3001\u7aef\u53e3\u5f02\u5e38\u68c0\u6d4b<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>\u5e94\u7528\u8fdb\u7a0b\u5065\u5eb7\u68c0\u67e5\u811a\u672c<\/td>\n<td>\u76d1\u63a7\u5173\u952e\u8fdb\u7a0b\u3001\u7aef\u53e3\u3001HTTP\u63a5\u53e3\u54cd\u5e94<\/td>\n<td>\u6838\u5fc3\u4e1a\u52a1&#xff08;Nginx\/MySQL\/Redis&#xff09;\u76d1\u63a7<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>\u5b89\u5168\u57fa\u7ebf\u68c0\u67e5\u811a\u672c<\/td>\n<td>\u68c0\u67e5\u8d26\u6237\u5b89\u5168\u3001SSH\u914d\u7f6e\u3001\u6587\u4ef6\u6743\u9650<\/td>\n<td>\u5b89\u5168\u5408\u89c4\u5ba1\u8ba1\u3001\u670d\u52a1\u5668\u52a0\u56fa<\/td>\n<\/tr>\n<tr>\n<td>6<\/td>\n<td>MySQL\u6570\u636e\u5e93\u68c0\u67e5\u811a\u672c<\/td>\n<td>\u68c0\u67e5\u8fde\u63a5\u6570\u3001\u6162\u67e5\u8be2\u3001\u4e3b\u4ece\u590d\u5236\u72b6\u6001<\/td>\n<td>MySQL\u5b9e\u4f8b\u5065\u5eb7\u76d1\u63a7<\/td>\n<\/tr>\n<tr>\n<td>7<\/td>\n<td>\u6279\u91cf\u670d\u52a1\u5668\u5de1\u68c0\u811a\u672c<\/td>\n<td>\u5e76\u53d1\u5de1\u68c0\u591a\u53f0\u670d\u52a1\u5668&#xff0c;\u751f\u6210HTML\u6c47\u603b\u62a5\u544a<\/td>\n<td>\u591a\u670d\u52a1\u5668\u96c6\u7fa4&#xff08;10\u53f0\u4ee5\u4e0a&#xff09;\u7ba1\u7406<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u811a\u672c1&#xff1a;\u7cfb\u7edf\u5065\u5eb7\u72b6\u6001\u5168\u9762\u68c0\u67e5&#xff08;\u6700\u5e38\u7528&#xff09;<\/h3>\n<h4>\u811a\u672c\u7528\u9014<\/h4>\n<p>\u65e5\u5e38\u5de1\u68c0\u6838\u5fc3\u811a\u672c&#xff0c;\u4e00\u952e\u68c0\u67e5\u670d\u52a1\u5668CPU\u3001\u5185\u5b58\u3001\u78c1\u76d8\u3001\u7f51\u7edc\u3001\u8fdb\u7a0b\u7b49\u5173\u952e\u6307\u6807&#xff0c;\u751f\u6210\u5e26\u989c\u8272\u7684\u62a5\u544a&#xff0c;\u5f02\u5e38\u6307\u6807\u81ea\u52a8\u6807\u9ec4\/\u7ea2\u3002<\/p>\n<h5>\u6838\u5fc3\u529f\u80fd<\/h5>\n<ul>\n<li>\n<p>\u6536\u96c6\u7cfb\u7edf\u57fa\u672c\u4fe1\u606f&#xff08;\u4e3b\u673a\u540d\u3001\u5185\u6838\u3001\u8fd0\u884c\u65f6\u957f&#xff09;\u2022<\/p>\n<\/li>\n<li>\n<p>\u68c0\u67e5CPU\u4f7f\u7528\u7387&#043;\u8d1f\u8f7d&#xff0c;\u663e\u793aTOP5\u9ad8CPU\u8fdb\u7a0b<\/p>\n<\/li>\n<li>\n<p>\u68c0\u67e5\u5185\u5b58\/swap\u4f7f\u7528&#xff0c;\u663e\u793aTOP5\u9ad8\u5185\u5b58\u8fdb\u7a0b<\/p>\n<\/li>\n<li>\n<p>\u68c0\u67e5\u78c1\u76d8\/Inode\u4f7f\u7528\u7387&#xff0c;\u5b9a\u4f4d\u5927\u76ee\u5f55<\/p>\n<\/li>\n<li>\n<p>\u68c0\u67e5\u7f51\u7edc\u63a5\u53e3\u3001TCP\u8fde\u63a5\u72b6\u6001&#xff08;TIME_WAIT\u8fc7\u591a\u9884\u8b66&#xff09;<\/p>\n<ul>\n<li>\n<p>\u68c0\u67e5\u50f5\u5c38\u8fdb\u7a0b\u3001\u5173\u952e\u670d\u52a1&#xff08;sshd\/crond&#xff09;\u8fd0\u884c\u72b6\u6001<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h5>\u4f7f\u7528\u6b65\u9aa4<\/h5>\n<ul>\n<li>\n<p>\u590d\u5236\u4e0b\u65b9\u4ee3\u7801&#xff0c;\u4fdd\u5b58\u4e3a system_health_check.sh<\/p>\n<\/li>\n<li>\n<p>\u8d4b\u4e88\u6267\u884c\u6743\u9650&#xff1a;chmod &#043;x system_health_check.sh<\/p>\n<\/li>\n<li>\n<p>\u6267\u884c\u811a\u672c&#xff1a;.\/system_health_check.sh&#xff08;\u9700root\u6743\u9650&#xff09;<\/p>\n<\/li>\n<li>\n<p>\u5b9a\u65f6\u6267\u884c&#xff08;\u6bcf\u5929\u65e98\u70b9&#xff09;&#xff1a;echo \u201c0 8 * * * \/path\/to\/system_health_check.sh\u201d | crontab &#8211;<\/p>\n<\/li>\n<\/ul>\n<h4>\u5b8c\u6574\u4ee3\u7801&#xff08;\u65b0\u624b\u6ce8\u610f\u4fee\u6539\u914d\u7f6e\u533a&#xff09;<\/h4>\n<p>#!\/bin\/bash<br \/>\n################################################################################<br \/>\n# \u811a\u672c\u540d\u79f0: system_health_check.sh<br \/>\n# \u529f\u80fd\u63cf\u8ff0: \u7cfb\u7edf\u5065\u5eb7\u72b6\u6001\u5168\u9762\u68c0\u67e5&#xff08;\u65b0\u624b\u7528\u524d\u6539\u914d\u7f6e\u533a&#xff01;&#xff09;<br \/>\n# \u7248\u672c\u4fe1\u606f: v2.0<br \/>\n################################################################################<br \/>\n\u200b<br \/>\n# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; \u65b0\u624b\u5fc5\u6539&#xff1a;\u914d\u7f6e\u533a &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\nHOSTNAME&#061;$(hostname)<br \/>\nDATE&#061;$(date &#043;&#034;%Y-%m-%d %H:%M:%S&#034;)<br \/>\n# \u62a5\u544a\u4fdd\u5b58\u8def\u5f84&#xff08;\u4e0d\u7528\u6539&#xff0c;\u9ed8\u8ba4\u5b58\/var\/log&#xff09;<br \/>\nREPORT_FILE&#061;&#034;\/var\/log\/system_check_$(date &#043;%Y%m%d_%H%M%S).log&#034;<br \/>\n\u200b<br \/>\n# \u544a\u8b66\u9608\u503c&#xff08;\u53ef\u6839\u636e\u670d\u52a1\u5668\u914d\u7f6e\u8c03\u6574&#xff09;<br \/>\nCPU_WARNING&#061;80 \u00a0 \u00a0 \u00a0 # CPU\u4f7f\u7528\u7387\u544a\u8b66\u9608\u503c(%)<br \/>\nMEM_WARNING&#061;85 \u00a0 \u00a0 \u00a0 # \u5185\u5b58\u4f7f\u7528\u7387\u544a\u8b66\u9608\u503c(%)<br \/>\nDISK_WARNING&#061;85 \u00a0 \u00a0 \u00a0# \u78c1\u76d8\u4f7f\u7528\u7387\u544a\u8b66\u9608\u503c(%)<br \/>\nLOAD_WARNING&#061;4 \u00a0 \u00a0 \u00a0 # \u7cfb\u7edf\u8d1f\u8f7d\u9608\u503c&#xff08;CPU\u6838\u5fc3\u6570*2&#xff0c;\u6bd4\u59824\u6838\u8bbe8&#xff09;<br \/>\nINODE_WARNING&#061;80 \u00a0 \u00a0 # Inode\u4f7f\u7528\u7387\u544a\u8b66\u9608\u503c(%)<br \/>\n# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n\u200b<br \/>\n# \u989c\u8272\u5b9a\u4e49&#xff08;\u4e0d\u7528\u6539&#xff09;<br \/>\nRED&#061;&#039;\\\\033[0;31m&#039;<br \/>\nGREEN&#061;&#039;\\\\033[0;32m&#039;<br \/>\nYELLOW&#061;&#039;\\\\033[1;33m&#039;<br \/>\nNC&#061;&#039;\\\\033[0m&#039; # \u91cd\u7f6e\u989c\u8272<br \/>\n\u200b<br \/>\n# \u65e5\u5fd7\u51fd\u6570&#xff08;\u4e0d\u7528\u6539&#xff09;<br \/>\nlog() { echo &#034;[$(date &#043;&#034;%Y-%m-%d %H:%M:%S&#034;)] $1&#034; | tee -a &#034;$REPORT_FILE&#034;; }<br \/>\nlog_section() { echo -e &#034;\\\\n&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034; | tee -a &#034;$REPORT_FILE&#034;; echo &#034; $1&#034; | tee -a &#034;$REPORT_FILE&#034;; echo &#034;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034; | tee -a &#034;$REPORT_FILE&#034;; }<br \/>\nlog_warning() { echo -e &#034;${YELLOW}[WARNING] $1${NC}&#034; | tee -a &#034;$REPORT_FILE&#034;; }<br \/>\nlog_error() { echo -e &#034;${RED}[ERROR] $1${NC}&#034; | tee -a &#034;$REPORT_FILE&#034;; }<br \/>\nlog_ok() { echo -e &#034;${GREEN}[OK] $1${NC}&#034; | tee -a &#034;$REPORT_FILE&#034;; }<br \/>\n\u200b<br \/>\n# 1. \u7cfb\u7edf\u57fa\u672c\u4fe1\u606f&#xff08;\u4e0d\u7528\u6539&#xff09;<br \/>\ncheck_basic_info() {<br \/>\n \u00a0  log_section &#034;1. \u7cfb\u7edf\u57fa\u672c\u4fe1\u606f&#034;<br \/>\n \u00a0  log &#034;\u4e3b\u673a\u540d: $HOSTNAME&#034;<br \/>\n \u00a0  log &#034;\u68c0\u67e5\u65f6\u95f4: $DATE&#034;<br \/>\n \u00a0  log &#034;\u7cfb\u7edf\u7248\u672c: $(cat \/etc\/redhat-release 2&gt;\/dev\/null || cat \/etc\/issue | head -1)&#034;<br \/>\n \u00a0  log &#034;\u5185\u6838\u7248\u672c: $(uname -r)&#034;<br \/>\n \u00a0  log &#034;\u7cfb\u7edf\u67b6\u6784: $(uname -m)&#034;<br \/>\n \u00a0  log &#034;\u8fd0\u884c\u65f6\u957f: $(uptime | awk -F&#039;up &#039; &#039;{print $2}&#039; | awk -F&#039;,&#039; &#039;{print $1}&#039;)&#034;<br \/>\n \u00a0  log &#034;\u5f53\u524d\u7528\u6237: $(whoami)&#034;<br \/>\n \u00a0  log &#034;\u767b\u5f55\u7528\u6237\u6570: $(who | wc -l)&#034;<br \/>\n}<br \/>\n\u200b<br \/>\n# 2. CPU\u68c0\u67e5&#xff08;\u4e0d\u7528\u6539&#xff09;<br \/>\ncheck_cpu() {<br \/>\n \u00a0  log_section &#034;2. CPU\u4f7f\u7528\u7387\u68c0\u67e5&#034;<br \/>\n \u00a0 \u00a0CPU_CORES&#061;$(grep -c ^processor \/proc\/cpuinfo)<br \/>\n \u00a0  log &#034;CPU\u6838\u5fc3\u6570: $CPU_CORES&#034;<br \/>\n \u00a0 \u00a0<br \/>\n \u00a0 \u00a0# \u83b7\u53d6CPU\u4f7f\u7528\u7387&#xff08;5\u79d2\u5e73\u5747\u503c&#xff0c;\u66f4\u51c6\u786e&#xff09;<br \/>\n \u00a0 \u00a0CPU_IDLE&#061;$(top -bn2 -d 1 | grep &#034;Cpu(s)&#034; | tail -1 | awk &#039;{print $8}&#039; | cut -d&#039;%&#039; -f1)<br \/>\n \u00a0 \u00a0CPU_USAGE&#061;$(echo &#034;scale&#061;2; 100 &#8211; $CPU_IDLE&#034; | bc)<br \/>\n \u00a0  log &#034;CPU\u4f7f\u7528\u7387: ${CPU_USAGE}%&#034;<br \/>\n \u00a0 \u00a0<br \/>\n \u00a0 \u00a0if (( $(echo &#034;$CPU_USAGE &gt; $CPU_WARNING&#034; | bc -l) )); then<br \/>\n \u00a0 \u00a0 \u00a0  log_warning &#034;CPU\u4f7f\u7528\u7387\u8d85\u8fc7${CPU_WARNING}%&#xff0c;\u5f53\u524d${CPU_USAGE}%&#034;<br \/>\n \u00a0 \u00a0 \u00a0  log &#034;TOP 5 CPU\u6d88\u8017\u8fdb\u7a0b:&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0ps aux | sort -rn -k3 | head -5 | awk &#039;{printf &#034;  PID: %-8s User: %-10s CPU: %-6s CMD: %s\\\\n&#034;, $2,$1,$3,$11}&#039; | tee -a &#034;$REPORT_FILE&#034;<br \/>\n \u00a0 \u00a0else<br \/>\n \u00a0 \u00a0 \u00a0  log_ok &#034;CPU\u4f7f\u7528\u7387\u6b63\u5e38: ${CPU_USAGE}%&#034;<br \/>\n \u00a0 \u00a0fi<br \/>\n \u00a0 \u00a0<br \/>\n \u00a0 \u00a0# \u7cfb\u7edf\u8d1f\u8f7d\u68c0\u67e5<br \/>\n \u00a0 \u00a0LOAD_1&#061;$(uptime | awk -F&#039;load average:&#039; &#039;{print $2}&#039; | awk -F&#039;,&#039; &#039;{print $1}&#039; | xargs)<br \/>\n \u00a0 \u00a0LOAD_5&#061;$(uptime | awk -F&#039;load average:&#039; &#039;{print $2}&#039; | awk -F&#039;,&#039; &#039;{print $2}&#039; | xargs)<br \/>\n \u00a0 \u00a0LOAD_15&#061;$(uptime | awk -F&#039;load average:&#039; &#039;{print $2}&#039; | awk -F&#039;,&#039; &#039;{print $3}&#039; | xargs)<br \/>\n \u00a0  log &#034;\u7cfb\u7edf\u8d1f\u8f7d: 1\u5206\u949f&#061;${LOAD_1}, 5\u5206\u949f&#061;${LOAD_5}, 15\u5206\u949f&#061;${LOAD_15}&#034;<br \/>\n \u00a0 \u00a0<br \/>\n \u00a0 \u00a0# \u8d1f\u8f7d\u9608\u503c&#061;CPU\u6838\u5fc3\u6570*2&#xff08;\u6bd4\u59824\u6838\u8bbe8&#xff09;<br \/>\n \u00a0 \u00a0LOAD_THRESHOLD&#061;$(echo &#034;$CPU_CORES * 2&#034; | bc)<br \/>\n \u00a0 \u00a0if (( $(echo &#034;$LOAD_1 &gt; $LOAD_THRESHOLD&#034; | bc -l) )); then<br \/>\n \u00a0 \u00a0 \u00a0  log_warning &#034;\u7cfb\u7edf\u8d1f\u8f7d\u8fc7\u9ad8&#xff01;1\u5206\u949f\u8d1f\u8f7d${LOAD_1}\u8d85\u8fc7\u9608\u503c${LOAD_THRESHOLD}&#034;<br \/>\n \u00a0 \u00a0fi<br \/>\n}<br \/>\n\u200b<br \/>\n# 3. \u5185\u5b58\u68c0\u67e5&#xff08;\u4e0d\u7528\u6539&#xff09;<br \/>\ncheck_memory() {<br \/>\n \u00a0  log_section &#034;3. \u5185\u5b58\u4f7f\u7528\u68c0\u67e5&#034;<br \/>\n \u00a0 \u00a0MEM_TOTAL&#061;$(free -m | awk &#039;NR&#061;&#061;2{print $2}&#039;)<br \/>\n \u00a0 \u00a0MEM_USED&#061;$(free -m | awk &#039;NR&#061;&#061;2{print $3}&#039;)<br \/>\n \u00a0 \u00a0MEM_AVAILABLE&#061;$(free -m | awk &#039;NR&#061;&#061;2{print $7}&#039;)<br \/>\n \u00a0 \u00a0MEM_USAGE&#061;$(echo &#034;scale&#061;2; $MEM_USED \/ $MEM_TOTAL * 100&#034; | bc)<br \/>\n \u00a0 \u00a0<br \/>\n \u00a0  log &#034;\u5185\u5b58\u603b\u91cf: ${MEM_TOTAL}MB&#034;<br \/>\n \u00a0  log &#034;\u5df2\u7528\u5185\u5b58: ${MEM_USED}MB&#034;<br \/>\n \u00a0  log &#034;\u53ef\u7528\u5185\u5b58: ${MEM_AVAILABLE}MB&#034;<br \/>\n \u00a0  log &#034;\u5185\u5b58\u4f7f\u7528\u7387: ${MEM_USAGE}%&#034;<br \/>\n \u00a0 \u00a0<br \/>\n \u00a0 \u00a0if (( $(echo &#034;$MEM_USAGE &gt; $MEM_WARNING&#034; | bc -l) )); then<br \/>\n \u00a0 \u00a0 \u00a0  log_warning &#034;\u5185\u5b58\u4f7f\u7528\u7387\u8d85\u8fc7${MEM_WARNING}%&#xff0c;\u5f53\u524d${MEM_USAGE}%&#034;<br \/>\n \u00a0 \u00a0 \u00a0  log &#034;TOP 5 \u5185\u5b58\u6d88\u8017\u8fdb\u7a0b:&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0ps aux | sort -rn -k4 | head -5 | awk &#039;{printf &#034;  PID: %-8s User: %-10s MEM: %-6s CMD: %s\\\\n&#034;, $2,$1,$4,$11}&#039; | tee -a &#034;$REPORT_FILE&#034;<br \/>\n \u00a0 \u00a0else<br \/>\n \u00a0 \u00a0 \u00a0  log_ok &#034;\u5185\u5b58\u4f7f\u7528\u7387\u6b63\u5e38: ${MEM_USAGE}%&#034;<br \/>\n \u00a0 \u00a0fi<br \/>\n \u00a0 \u00a0<br \/>\n \u00a0 \u00a0# Swap\u68c0\u67e5&#xff08;\u8d85\u8fc7100MB\u9884\u8b66&#xff09;<br \/>\n \u00a0 \u00a0SWAP_TOTAL&#061;$(free -m | awk &#039;NR&#061;&#061;3{print $2}&#039;)<br \/>\n \u00a0 \u00a0SWAP_USED&#061;$(free -m | awk &#039;NR&#061;&#061;3{print $3}&#039;)<br \/>\n \u00a0  log &#034;Swap\u603b\u91cf: ${SWAP_TOTAL}MB&#034;<br \/>\n \u00a0  log &#034;Swap\u4f7f\u7528: ${SWAP_USED}MB&#034;<br \/>\n \u00a0 \u00a0if [ &#034;$SWAP_TOTAL&#034; -gt 0 ] &amp;&amp; [ &#034;$SWAP_USED&#034; -gt 100 ]; then<br \/>\n \u00a0 \u00a0 \u00a0  log_warning &#034;Swap\u4f7f\u7528\u91cf\u8f83\u9ad8: ${SWAP_USED}MB&#xff0c;\u53ef\u80fd\u5b58\u5728\u5185\u5b58\u538b\u529b&#034;<br \/>\n \u00a0 \u00a0fi<br \/>\n}<br \/>\n\u200b<br \/>\n# 4. \u78c1\u76d8\u68c0\u67e5&#xff08;\u4e0d\u7528\u6539&#xff09;<br \/>\ncheck_disk() {<br \/>\n \u00a0  log_section &#034;4. \u78c1\u76d8\u4f7f\u7528\u68c0\u67e5&#034;<br \/>\n \u00a0  log &#034;\u78c1\u76d8\u5206\u533a\u4f7f\u7528\u60c5\u51b5:&#034;<br \/>\n \u00a0  df -h | grep -vE &#039;^Filesystem|tmpfs|cdrom|loop&#039; | awk &#039;{print &#034;  &#034; $0}&#039; | tee -a &#034;$REPORT_FILE&#034;<br \/>\n \u00a0 \u00a0<br \/>\n \u00a0 \u00a0# \u78c1\u76d8\u4f7f\u7528\u7387\u544a\u8b66<br \/>\n \u00a0 \u00a0HAS_DISK_WARNING&#061;0<br \/>\n \u00a0 \u00a0while read line; do<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0USAGE&#061;$(echo $line | awk &#039;{print $5}&#039; | sed &#039;s\/%\/\/&#039;)<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0MOUNT&#061;$(echo $line | awk &#039;{print $6}&#039;)<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0if [ &#034;$USAGE&#034; -gt &#034;$DISK_WARNING&#034; ]; then<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  log_warning &#034;\u78c1\u76d8\u5206\u533a $MOUNT \u4f7f\u7528\u7387${USAGE}%\u8d85\u8fc7\u9608\u503c${DISK_WARNING}%&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0HAS_DISK_WARNING&#061;1<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  log &#034; \u00a0$MOUNT \u5206\u533a\u5360\u7528\u7a7a\u95f4\u6700\u5927\u76845\u4e2a\u76ee\u5f55:&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  du -sh ${MOUNT}\/* 2&gt;\/dev\/null | sort -rh | head -5 | awk &#039;{print &#034; \u00a0  &#034; $0}&#039; | tee -a &#034;$REPORT_FILE&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0fi<br \/>\n \u00a0 \u00a0done &lt; &lt;(df -h | grep -vE &#039;^Filesystem|tmpfs|cdrom|loop&#039;)<br \/>\n \u00a0 \u00a0<br \/>\n \u00a0 \u00a0if [ $HAS_DISK_WARNING -eq 0 ]; then<br \/>\n \u00a0 \u00a0 \u00a0  log_ok &#034;\u6240\u6709\u78c1\u76d8\u5206\u533a\u4f7f\u7528\u7387\u6b63\u5e38&#034;<br \/>\n \u00a0 \u00a0fi<br \/>\n \u00a0 \u00a0<br \/>\n \u00a0 \u00a0# Inode\u68c0\u67e5&#xff08;\u907f\u514d\u5c0f\u6587\u4ef6\u5360\u6ee1\u78c1\u76d8&#xff09;<br \/>\n \u00a0  log -e &#034;\\\\nInode\u4f7f\u7528\u60c5\u51b5:&#034;<br \/>\n \u00a0  df -i | grep -vE &#039;^Filesystem|tmpfs|cdrom|loop&#039; | awk &#039;{print &#034;  &#034; $0}&#039; | tee -a &#034;$REPORT_FILE&#034;<br \/>\n \u00a0 \u00a0while read line; do<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0INODE_USAGE&#061;$(echo $line | awk &#039;{print $5}&#039; | sed &#039;s\/%\/\/&#039;)<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0MOUNT&#061;$(echo $line | awk &#039;{print $6}&#039;)<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0if [ &#034;$INODE_USAGE&#034; -gt &#034;$INODE_WARNING&#034; ]; then<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  log_warning &#034;\u5206\u533a $MOUNT \u7684Inode\u4f7f\u7528\u7387${INODE_USAGE}%\u8d85\u8fc7\u9608\u503c${INODE_WARNING}%&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0fi<br \/>\n \u00a0 \u00a0done &lt; &lt;(df -i | grep -vE &#039;^Filesystem|tmpfs|cdrom|loop&#039;)<br \/>\n}<br \/>\n\u200b<br \/>\n# 5. \u7f51\u7edc\u68c0\u67e5&#xff08;\u4e0d\u7528\u6539&#xff09;<br \/>\ncheck_network() {<br \/>\n \u00a0  log_section &#034;5. \u7f51\u7edc\u72b6\u6001\u68c0\u67e5&#034;<br \/>\n \u00a0  log &#034;\u7f51\u7edc\u63a5\u53e3\u72b6\u6001:&#034;<br \/>\n \u00a0  ip -br addr | awk &#039;{print &#034;  &#034; $0}&#039; | tee -a &#034;$REPORT_FILE&#034;<br \/>\n \u00a0 \u00a0<br \/>\n \u00a0 \u00a0# TCP\u8fde\u63a5\u7edf\u8ba1<br \/>\n \u00a0  log -e &#034;\\\\nTCP\u8fde\u63a5\u72b6\u6001\u7edf\u8ba1:&#034;<br \/>\n \u00a0  netstat -an | awk &#039;\/^tcp\/ {print $6}&#039; | sort | uniq -c | sort -rn | awk &#039;{print &#034;  &#034; $0}&#039; | tee -a &#034;$REPORT_FILE&#034;<br \/>\n \u00a0 \u00a0<br \/>\n \u00a0 \u00a0# TIME_WAIT\u8fc7\u591a\u9884\u8b66&#xff08;\u8d85\u8fc75000&#xff09;<br \/>\n \u00a0 \u00a0TIME_WAIT_COUNT&#061;$(netstat -an | grep TIME_WAIT | wc -l)<br \/>\n \u00a0  log &#034;TIME_WAIT\u8fde\u63a5\u6570: $TIME_WAIT_COUNT&#034;<br \/>\n \u00a0 \u00a0if [ &#034;$TIME_WAIT_COUNT&#034; -gt 5000 ]; then<br \/>\n \u00a0 \u00a0 \u00a0  log_warning &#034;TIME_WAIT\u8fde\u63a5\u6570\u8fc7\u591a: $TIME_WAIT_COUNT&#xff08;\u53ef\u4f18\u5316TCP\u53c2\u6570&#xff09;&#034;<br \/>\n \u00a0 \u00a0fi<br \/>\n \u00a0 \u00a0<br \/>\n \u00a0 \u00a0# \u76d1\u542c\u7aef\u53e3\u68c0\u67e5<br \/>\n \u00a0  log -e &#034;\\\\n\u5f53\u524d\u76d1\u542c\u7aef\u53e3:&#034;<br \/>\n \u00a0  netstat -tuln | grep LISTEN | awk &#039;{print &#034;  &#034; $0}&#039; | tee -a &#034;$REPORT_FILE&#034;<br \/>\n}<br \/>\n\u200b<br \/>\n# 6. \u8fdb\u7a0b\u548c\u670d\u52a1\u68c0\u67e5&#xff08;\u4e0d\u7528\u6539&#xff09;<br \/>\ncheck_processes() {<br \/>\n \u00a0  log_section &#034;6. \u8fdb\u7a0b\u548c\u670d\u52a1\u68c0\u67e5&#034;<br \/>\n \u00a0 \u00a0PROCESS_COUNT&#061;$(ps aux | wc -l)<br \/>\n \u00a0  log &#034;\u5f53\u524d\u8fdb\u7a0b\u603b\u6570: $PROCESS_COUNT&#034;<br \/>\n \u00a0 \u00a0<br \/>\n \u00a0 \u00a0# \u50f5\u5c38\u8fdb\u7a0b\u68c0\u67e5&#xff08;\u6b7b\u8fdb\u7a0b\u6ca1\u6e05\u7406&#xff09;<br \/>\n \u00a0 \u00a0ZOMBIE_COUNT&#061;$(ps aux | awk &#039;{print $8}&#039; | grep -c Z)<br \/>\n \u00a0  log &#034;\u50f5\u5c38\u8fdb\u7a0b\u6570: $ZOMBIE_COUNT&#034;<br \/>\n \u00a0 \u00a0if [ &#034;$ZOMBIE_COUNT&#034; -gt 0 ]; then<br \/>\n \u00a0 \u00a0 \u00a0  log_warning &#034;\u53d1\u73b0\u50f5\u5c38\u8fdb\u7a0b!&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0ps aux | grep &#039;Z&#039; | grep -v grep | awk &#039;{print &#034;  PID: &#034; $2 &#034; PPID: &#034; $3 &#034; CMD: &#034; $11}&#039; | tee -a &#034;$REPORT_FILE&#034;<br \/>\n \u00a0 \u00a0fi<br \/>\n \u00a0 \u00a0<br \/>\n \u00a0 \u00a0# \u5173\u952e\u670d\u52a1\u68c0\u67e5&#xff08;\u65b0\u624b\u53ef\u52a0\u81ea\u5df1\u7684\u670d\u52a1&#xff0c;\u6bd4\u5982nginx\/mysql&#xff09;<br \/>\n \u00a0  log -e &#034;\\\\n\u5173\u952e\u670d\u52a1\u72b6\u6001\u68c0\u67e5:&#034;<br \/>\n \u00a0 \u00a0CRITICAL_SERVICES&#061;(&#034;sshd&#034; &#034;crond&#034; &#034;rsyslog&#034;) # \u53ef\u6dfb\u52a0\u670d\u52a1&#xff0c;\u5982&#034;nginx&#034; &#034;mysqld&#034;<br \/>\n \u00a0 \u00a0for service in &#034;${CRITICAL_SERVICES[&#064;]}&#034;; do<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0if systemctl is-active &#8211;quiet $service 2&gt;\/dev\/null; then<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  log_ok &#034; \u00a0$service: \u8fd0\u884c\u4e2d&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0else<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0# \u517c\u5bb9\u975esystemd\u7cfb\u7edf&#xff08;\u5982CentOS 6&#xff09;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0if ps aux | grep -v grep | grep -q $service; then<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  log_ok &#034; \u00a0$service: \u8fd0\u884c\u4e2d&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0else<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  log_error &#034; \u00a0$service: \u672a\u8fd0\u884c&#xff08;\u9700\u624b\u52a8\u542f\u52a8&#xff09;&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0fi<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0fi<br \/>\n \u00a0 \u00a0done<br \/>\n}<br \/>\n\u200b<br \/>\n# 7. \u7cfb\u7edf\u65e5\u5fd7\u68c0\u67e5&#xff08;\u4e0d\u7528\u6539&#xff09;<br \/>\ncheck_logs() {<br \/>\n \u00a0  log_section &#034;7. \u7cfb\u7edf\u65e5\u5fd7\u68c0\u67e5&#034;<br \/>\n \u00a0  log &#034;\u6700\u8fd11\u5c0f\u65f6\u7cfb\u7edf\u9519\u8bef\u65e5\u5fd7:&#034;<br \/>\n \u00a0 \u00a0if [ -f \/var\/log\/messages ]; then<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0ERROR_COUNT&#061;$(grep -i &#034;error\\\\|fail\\\\|critical&#034; \/var\/log\/messages | tail -20 | wc -l)<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0if [ &#034;$ERROR_COUNT&#034; -gt 0 ]; then<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  log_warning &#034;\u53d1\u73b0 $ERROR_COUNT \u6761\u9519\u8bef\u65e5\u5fd7&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0grep -i &#034;error\\\\|fail\\\\|critical&#034; \/var\/log\/messages | tail -10 | awk &#039;{print &#034;  &#034; $0}&#039; | tee -a &#034;$REPORT_FILE&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0else<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  log_ok &#034;\u65e0\u4e25\u91cd\u9519\u8bef\u65e5\u5fd7&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0fi<br \/>\n \u00a0 \u00a0fi<br \/>\n \u00a0 \u00a0<br \/>\n \u00a0 \u00a0# OOM\u68c0\u67e5&#xff08;\u5185\u5b58\u6ea2\u51fa\u5bfc\u81f4\u8fdb\u7a0b\u88ab\u6740&#xff09;<br \/>\n \u00a0  log -e &#034;\\\\nOOM(\u5185\u5b58\u6ea2\u51fa)\u68c0\u67e5:&#034;<br \/>\n \u00a0 \u00a0OOM_COUNT&#061;$(dmesg | grep -i &#034;out of memory&#034; | wc -l)<br \/>\n \u00a0 \u00a0if [ &#034;$OOM_COUNT&#034; -gt 0 ]; then<br \/>\n \u00a0 \u00a0 \u00a0  log_warning &#034;\u53d1\u73b0 $OOM_COUNT \u6b21OOM\u4e8b\u4ef6&#xff08;\u9700\u68c0\u67e5\u5185\u5b58\u914d\u7f6e&#xff09;&#034;<br \/>\n \u00a0 \u00a0 \u00a0  dmesg | grep -i &#034;out of memory&#034; | tail -5 | awk &#039;{print &#034;  &#034; $0}&#039; | tee -a &#034;$REPORT_FILE&#034;<br \/>\n \u00a0 \u00a0else<br \/>\n \u00a0 \u00a0 \u00a0  log_ok &#034;\u65e0OOM\u4e8b\u4ef6&#034;<br \/>\n \u00a0 \u00a0fi<br \/>\n}<br \/>\n\u200b<br \/>\n# 8. \u62a5\u544a\u6458\u8981&#xff08;\u4e0d\u7528\u6539&#xff09;<br \/>\ngenerate_summary() {<br \/>\n \u00a0  log_section &#034;8. \u5de1\u68c0\u62a5\u544a\u6458\u8981&#034;<br \/>\n \u00a0 \u00a0WARNING_COUNT&#061;$(grep -c &#034;\\\\[WARNING\\\\]&#034; &#034;$REPORT_FILE&#034;)<br \/>\n \u00a0 \u00a0ERROR_COUNT&#061;$(grep -c &#034;\\\\[ERROR\\\\]&#034; &#034;$REPORT_FILE&#034;)<br \/>\n \u00a0  log &#034;\u5de1\u68c0\u5b8c\u6210\u65f6\u95f4: $(date &#043;&#034;%Y-%m-%d %H:%M:%S&#034;)&#034;<br \/>\n \u00a0  log &#034;\u544a\u8b66\u6570\u91cf: $WARNING_COUNT&#034;<br \/>\n \u00a0  log &#034;\u9519\u8bef\u6570\u91cf: $ERROR_COUNT&#034;<br \/>\n \u00a0 \u00a0<br \/>\n \u00a0 \u00a0if [ &#034;$ERROR_COUNT&#034; -gt 0 ]; then<br \/>\n \u00a0 \u00a0 \u00a0  log_error &#034;\u53d1\u73b0 $ERROR_COUNT \u4e2a\u4e25\u91cd\u95ee\u9898&#xff0c;\u8bf7\u7acb\u5373\u5904\u7406!&#034;<br \/>\n \u00a0 \u00a0elif [ &#034;$WARNING_COUNT&#034; -gt 0 ]; then<br \/>\n \u00a0 \u00a0 \u00a0  log_warning &#034;\u53d1\u73b0 $WARNING_COUNT \u4e2a\u544a\u8b66&#xff0c;\u5efa\u8bae\u5173\u6ce8&#034;<br \/>\n \u00a0 \u00a0else<br \/>\n \u00a0 \u00a0 \u00a0  log_ok &#034;\u7cfb\u7edf\u72b6\u6001\u826f\u597d&#xff0c;\u65e0\u5f02\u5e38&#034;<br \/>\n \u00a0 \u00a0fi<br \/>\n \u00a0  log -e &#034;\\\\n\u5b8c\u6574\u62a5\u544a\u5df2\u4fdd\u5b58\u81f3: $REPORT_FILE&#034;<br \/>\n}<br \/>\n\u200b<br \/>\n# \u4e3b\u51fd\u6570&#xff08;\u4e0d\u7528\u6539&#xff09;<br \/>\nmain() {<br \/>\n \u00a0 \u00a0echo &#034;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034;<br \/>\n \u00a0 \u00a0echo &#034; \u00a0  \u670d\u52a1\u5668\u5065\u5eb7\u72b6\u6001\u5de1\u68c0\u811a\u672c v2.0&#034;<br \/>\n \u00a0 \u00a0echo &#034;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034;<br \/>\n \u00a0 \u00a0echo -e &#034;\\\\n&#034;<br \/>\n \u00a0 \u00a0<br \/>\n \u00a0 \u00a0# \u975eroot\u7528\u6237\u63d0\u793a&#xff08;\u90e8\u5206\u68c0\u67e5\u9700\u8981root&#xff09;<br \/>\n \u00a0 \u00a0if [ &#034;$(id -u)&#034; -ne 0 ]; then<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0echo &#034;\u8b66\u544a: \u975eroot\u7528\u6237\u8fd0\u884c&#xff0c;\u90e8\u5206\u68c0\u67e5\u53ef\u80fd\u65e0\u6cd5\u6267\u884c&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0echo -e &#034;\\\\n&#034;<br \/>\n \u00a0 \u00a0fi<br \/>\n \u00a0 \u00a0<br \/>\n \u00a0 \u00a0# \u6267\u884c\u6240\u6709\u68c0\u67e5<br \/>\n \u00a0  check_basic_info<br \/>\n \u00a0  check_cpu<br \/>\n \u00a0  check_memory<br \/>\n \u00a0  check_disk<br \/>\n \u00a0  check_network<br \/>\n \u00a0  check_processes<br \/>\n \u00a0  check_logs<br \/>\n \u00a0  generate_summary<br \/>\n \u00a0 \u00a0<br \/>\n \u00a0 \u00a0echo -e &#034;\\\\n&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034;<br \/>\n \u00a0 \u00a0echo &#034; \u00a0  \u5de1\u68c0\u5b8c\u6210!&#034;<br \/>\n \u00a0 \u00a0echo &#034;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034;<br \/>\n}<br \/>\n\u200b<br \/>\n# \u811a\u672c\u5165\u53e3&#xff08;\u4e0d\u7528\u6539&#xff09;<br \/>\nmain &#034;$&#064;&#034; <\/p>\n<h4>\u65b0\u624b\u907f\u5751<\/h4>\n<li>\n<p>\u6743\u9650\u95ee\u9898&#xff1a;\u6267\u884c\u524d\u786e\u4fdd\u662froot\u7528\u6237&#xff08;sudo -i\u5207\u6362&#xff09;&#xff0c;\u5426\u5219\u78c1\u76d8\u3001\u8fdb\u7a0b\u68c0\u67e5\u53ef\u80fd\u4e0d\u51c6\u3002<\/p>\n<\/li>\n<li>\n<p>\u547d\u4ee4\u7f3a\u5931&#xff1a;\u5982\u679c\u63d0\u793anetstat: command not found&#xff0c;\u5b89\u88c5\u4f9d\u8d56&#xff1a;yum install net-tools&#xff08;CentOS&#xff09;\u6216apt install net-tools&#xff08;Ubuntu&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u62a5\u544a\u67e5\u770b&#xff1a;\u5de1\u68c0\u5b8c\u6210\u540e&#xff0c;\u62a5\u544a\u5b58\u653e\u5728\/var\/log\u76ee\u5f55\u4e0b&#xff0c;\u6587\u4ef6\u540d\u5e26\u65f6\u95f4\u6233&#xff08;\u5982system_check_20251022_083000.log&#xff09;\u3002<\/p>\n<\/li>\n<h3>\u811a\u672c2&#xff1a;\u78c1\u76d8\u7a7a\u95f4\u6df1\u5ea6\u68c0\u67e5\u811a\u672c<\/h3>\n<h4>\u811a\u672c\u7528\u9014<\/h4>\n<p>\u4e13\u95e8\u5b9a\u4f4d\u78c1\u76d8\u6ee1\u7684\u539f\u56e0&#xff1a;\u627e\u51fa\u5927\u6587\u4ef6\u3001\u65e7\u65e5\u5fd7\u3001\u4e34\u65f6\u6587\u4ef6&#xff0c;\u8fd8\u80fd\u9884\u6d4b\u78c1\u76d8\u6ee1\u7684\u65f6\u95f4&#xff0c;\u7ed9\u51fa\u6e05\u7406\u5efa\u8bae\u3002<\/p>\n<h5>\u6838\u5fc3\u529f\u80fd<\/h5>\n<ul>\n<li>\n<p>\u68c0\u67e5\u78c1\u76d8\/Inode\u4f7f\u7528\u7387&#xff0c;\u5b9a\u4f4d\u5927\u76ee\u5f55&#xff08;TOP10&#xff09;<\/p>\n<\/li>\n<li>\n<p>\u67e5\u627e\u8d851G\u7684\u5927\u6587\u4ef6&#xff08;\u53ef\u4fee\u6539\u9608\u503c&#xff09;<\/p>\n<\/li>\n<li>\n<p>\u68c0\u67e530\u5929\u524d\u672a\u6e05\u7406\u7684\u65e7\u65e5\u5fd7<\/p>\n<\/li>\n<li>\n<p>\u6e05\u7406\/tmp\u76ee\u5f55\u4e0b7\u5929\u672a\u4f7f\u7528\u7684\u4e34\u65f6\u6587\u4ef6<\/p>\n<\/li>\n<li>\n<p>\u68c0\u67e5\u78c1\u76d8IO\u7b49\u5f85&#xff08;\u907f\u514dIO\u8fc7\u9ad8\u5bfc\u81f4\u5361\u987f&#xff09;<\/p>\n<\/li>\n<\/ul>\n<h5>\u4f7f\u7528\u6b65\u9aa4<\/h5>\n<ul>\n<li>\n<p>\u590d\u5236\u4ee3\u7801\u4fdd\u5b58\u4e3a disk_space_check.sh<\/p>\n<\/li>\n<li>\n<p>\u8d4b\u4e88\u6743\u9650&#xff1a;chmod &#043;x disk_space_check.sh<\/p>\n<\/li>\n<li>\n<p>\u6267\u884c&#xff1a;.\/disk_space_check.sh&#xff08;root\u7528\u6237&#xff09;<\/p>\n<\/li>\n<\/ul>\n<h4>\u5b8c\u6574\u4ee3\u7801&#xff08;\u65b0\u624b\u6539\u914d\u7f6e\u533a&#xff09;<\/h4>\n<p>#!\/bin\/bash<br \/>\n################################################################################<br \/>\n# \u811a\u672c\u540d\u79f0: disk_space_check.sh<br \/>\n# \u529f\u80fd\u63cf\u8ff0: \u78c1\u76d8\u7a7a\u95f4\u6df1\u5ea6\u68c0\u67e5&#xff08;\u65b0\u624b\u6539\u914d\u7f6e\u533a&#xff01;&#xff09;<br \/>\n# \u7248\u672c\u4fe1\u606f: v1.5<br \/>\n################################################################################<br \/>\n\u200b<br \/>\n# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; \u65b0\u624b\u5fc5\u6539&#xff1a;\u914d\u7f6e\u533a &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\nREPORT_FILE&#061;&#034;\/var\/log\/disk_check_$(date &#043;%Y%m%d_%H%M%S).log&#034;<br \/>\nDISK_WARNING&#061;80 \u00a0 \u00a0 \u00a0 # \u78c1\u76d8\u4f7f\u7528\u7387\u544a\u8b66\u9608\u503c(%)<br \/>\nINODE_WARNING&#061;80 \u00a0 \u00a0 \u00a0# Inode\u4f7f\u7528\u7387\u544a\u8b66\u9608\u503c(%)<br \/>\nLARGE_FILE_SIZE&#061;1G \u00a0 \u00a0# \u5927\u6587\u4ef6\u9608\u503c&#xff08;\u53ef\u6539500M\u30012G&#xff09;<br \/>\n# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n\u200b<br \/>\n# \u989c\u8272\u5b9a\u4e49&#xff08;\u4e0d\u7528\u6539&#xff09;<br \/>\nRED&#061;&#039;\\\\033[0;31m&#039;<br \/>\nGREEN&#061;&#039;\\\\033[0;32m&#039;<br \/>\nYELLOW&#061;&#039;\\\\033[1;33m&#039;<br \/>\nNC&#061;&#039;\\\\033[0m&#039;<br \/>\n\u200b<br \/>\n# \u65e5\u5fd7\u51fd\u6570&#xff08;\u4e0d\u7528\u6539&#xff09;<br \/>\nlog() { echo &#034;[$(date &#043;&#034;%Y-%m-%d %H:%M:%S&#034;)] $1&#034; | tee -a &#034;$REPORT_FILE&#034;; }<br \/>\nlog_warning() { echo -e &#034;${YELLOW}[WARNING] $1${NC}&#034; | tee -a &#034;$REPORT_FILE&#034;; }<br \/>\nlog_error() { echo -e &#034;${RED}[ERROR] $1${NC}&#034; | tee -a &#034;$REPORT_FILE&#034;; }<br \/>\nlog_ok() { echo -e &#034;${GREEN}[OK] $1${NC}&#034; | tee -a &#034;$REPORT_FILE&#034;; }<br \/>\n\u200b<br \/>\n# 1. \u78c1\u76d8\u4f7f\u7528\u7387\u68c0\u67e5&#xff08;\u4e0d\u7528\u6539&#xff09;<br \/>\ncheck_disk_usage() {<br \/>\n \u00a0  log &#034;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034;<br \/>\n \u00a0  log &#034;1. \u78c1\u76d8\u4f7f\u7528\u7387\u68c0\u67e5&#034;<br \/>\n \u00a0  log &#034;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034;<br \/>\n \u00a0  df -h | grep -vE &#039;^Filesystem|tmpfs|cdrom|loop&#039; | while read line; do<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0USAGE&#061;$(echo $line | awk &#039;{print $5}&#039; | sed &#039;s\/%\/\/&#039;)<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0MOUNT&#061;$(echo $line | awk &#039;{print $6}&#039;)<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0AVAIL&#061;$(echo $line | awk &#039;{print $4}&#039;)<br \/>\n \u00a0 \u00a0 \u00a0  log &#034;\u5206\u533a: $MOUNT&#034;<br \/>\n \u00a0 \u00a0 \u00a0  log &#034;  \u4f7f\u7528\u7387: ${USAGE}%&#034;<br \/>\n \u00a0 \u00a0 \u00a0  log &#034;  \u53ef\u7528\u7a7a\u95f4: $AVAIL&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0if [ &#034;$USAGE&#034; -gt &#034;$DISK_WARNING&#034; ]; then<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  log_error &#034;  \u78c1\u76d8\u4f7f\u7528\u7387\u8d85\u8fc7${DISK_WARNING}%&#xff01;&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0# \u663e\u793aTOP10\u5927\u76ee\u5f55<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  log &#034;  \u5360\u7528\u7a7a\u95f4TOP 10\u76ee\u5f55:&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  du -sh ${MOUNT}\/* 2&gt;\/dev\/null | sort -rh | head -10 | awk &#039;{print &#034; \u00a0  &#034; $0}&#039; | tee -a &#034;$REPORT_FILE&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0# \u663e\u793a\u8d85\u9608\u503c\u7684\u5927\u6587\u4ef6<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  log &#034;  \u5927\u6587\u4ef6(&gt;$LARGE_FILE_SIZE):&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0find ${MOUNT} -type f -size &#043;${LARGE_FILE_SIZE} -exec ls -lh {} \\\\; 2&gt;\/dev\/null | awk &#039;{print &#034; \u00a0  &#034; $9 &#034; (&#034; $5 &#034;)&#034;}&#039; | head -10 | tee -a &#034;$REPORT_FILE&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0else<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  log_ok &#034;  \u4f7f\u7528\u7387\u6b63\u5e38&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0fi<br \/>\n \u00a0 \u00a0 \u00a0  log &#034;&#034;<br \/>\n \u00a0 \u00a0done<br \/>\n}<br \/>\n\u200b<br \/>\n# 2. Inode\u68c0\u67e5&#xff08;\u5c0f\u6587\u4ef6\u5360\u6ee1\u78c1\u76d8\u7528&#xff09;&#xff08;\u4e0d\u7528\u6539&#xff09;<br \/>\ncheck_inode_usage() {<br \/>\n \u00a0  log &#034;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034;<br \/>\n \u00a0  log &#034;2. Inode\u4f7f\u7528\u7387\u68c0\u67e5&#034;<br \/>\n \u00a0  log &#034;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034;<br \/>\n \u00a0  df -i | grep -vE &#039;^Filesystem|tmpfs|cdrom|loop&#039; | while read line; do<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0INODE_USAGE&#061;$(echo $line | awk &#039;{print $5}&#039; | sed &#039;s\/%\/\/&#039;)<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0MOUNT&#061;$(echo $line | awk &#039;{print $6}&#039;)<br \/>\n \u00a0 \u00a0 \u00a0  log &#034;\u5206\u533a: $MOUNT&#034;<br \/>\n \u00a0 \u00a0 \u00a0  log &#034;  Inode\u4f7f\u7528\u7387: ${INODE_USAGE}%&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0if [ &#034;$INODE_USAGE&#034; -gt &#034;$INODE_WARNING&#034; ]; then<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  log_error &#034;  Inode\u4f7f\u7528\u7387\u8d85\u8fc7${INODE_WARNING}%&#xff01;&#xff08;\u5c0f\u6587\u4ef6\u592a\u591a&#xff09;&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0# \u663e\u793a\u6587\u4ef6\u6570TOP10\u76ee\u5f55<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  log &#034;  \u6587\u4ef6\u6570\u91cfTOP 10\u76ee\u5f55:&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0for dir in $(find ${MOUNT}\/* -maxdepth 0 -type d 2&gt;\/dev\/null); do<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0echo &#034;$(find $dir -type f 2&gt;\/dev\/null | wc -l) $dir&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0done | sort -rn | head -10 | awk &#039;{print &#034; \u00a0  &#034; $1 &#034; files: &#034; $2}&#039; | tee -a &#034;$REPORT_FILE&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0else<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  log_ok &#034;  Inode\u4f7f\u7528\u7387\u6b63\u5e38&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0fi<br \/>\n \u00a0 \u00a0 \u00a0  log &#034;&#034;<br \/>\n \u00a0 \u00a0done<br \/>\n}<br \/>\n\u200b<br \/>\n# 3. \u65e5\u5fd7\u6587\u4ef6\u68c0\u67e5&#xff08;\u4e0d\u7528\u6539&#xff09;<br \/>\ncheck_log_files() {<br \/>\n \u00a0  log &#034;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034;<br \/>\n \u00a0  log &#034;3. \u65e5\u5fd7\u6587\u4ef6\u5927\u5c0f\u68c0\u67e5&#034;<br \/>\n \u00a0  log &#034;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034;<br \/>\n \u00a0 \u00a0# \u5e38\u89c1\u65e5\u5fd7\u76ee\u5f55&#xff08;\u53ef\u52a0\u81ea\u5df1\u7684\u65e5\u5fd7\u76ee\u5f55&#xff0c;\u5982\/opt\/logs&#xff09;<br \/>\n \u00a0 \u00a0LOG_DIRS&#061;(&#034;\/var\/log&#034; &#034;\/opt\/logs&#034; &#034;\/data\/logs&#034; &#034;\/app\/logs&#034;)<br \/>\n \u00a0 \u00a0for log_dir in &#034;${LOG_DIRS[&#064;]}&#034;; do<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0if [ -d &#034;$log_dir&#034; ]; then<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  log &#034;\u68c0\u67e5\u76ee\u5f55: $log_dir&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0# \u663e\u793a\u8d85100MB\u7684\u65e5\u5fd7<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  log &#034;  \u5927\u65e5\u5fd7\u6587\u4ef6(&gt;100MB):&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0find $log_dir -type f -size &#043;100M -exec ls -lh {} \\\\; 2&gt;\/dev\/null | awk &#039;{print &#034; \u00a0  &#034; $9 &#034; (&#034; $5 &#034;)&#034;}&#039; | head -10 | tee -a &#034;$REPORT_FILE&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0# \u65e5\u5fd7\u603b\u5927\u5c0f<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0TOTAL_SIZE&#061;$(du -sh $log_dir 2&gt;\/dev\/null | awk &#039;{print $1}&#039;)<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  log &#034;  \u603b\u5927\u5c0f: $TOTAL_SIZE&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  log &#034;&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0fi<br \/>\n \u00a0 \u00a0done<br \/>\n \u00a0 \u00a0<br \/>\n \u00a0 \u00a0# 30\u5929\u524d\u672a\u538b\u7f29\u7684\u65e7\u65e5\u5fd7<br \/>\n \u00a0  log &#034;\u672a\u538b\u7f29\u7684\u65e7\u65e5\u5fd7\u6587\u4ef6(30\u5929\u524d):&#034;<br \/>\n \u00a0 \u00a0find \/var\/log -type f -name &#034;*.log&#034; -mtime &#043;30 ! -name &#034;*.gz&#034; -exec ls -lh {} \\\\; 2&gt;\/dev\/null | awk &#039;{print &#034;  &#034; $9 &#034; (&#034; $5 &#034;)&#034;}&#039; | head -10 | tee -a &#034;$REPORT_FILE&#034;<br \/>\n}<br \/>\n\u200b<br \/>\n# 4. \u4e34\u65f6\u6587\u4ef6\u68c0\u67e5&#xff08;\u4e0d\u7528\u6539&#xff09;<br \/>\ncheck_temp_files() {<br \/>\n \u00a0  log &#034;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034;<br \/>\n \u00a0  log &#034;4. \u4e34\u65f6\u6587\u4ef6\u68c0\u67e5&#034;<br \/>\n \u00a0  log &#034;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034;<br \/>\n \u00a0 \u00a0# \/tmp\u76ee\u5f55\u68c0\u67e5<br \/>\n \u00a0 \u00a0if [ -d &#034;\/tmp&#034; ]; then<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0TMP_SIZE&#061;$(du -sh \/tmp 2&gt;\/dev\/null | awk &#039;{print $1}&#039;)<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0TMP_FILE_COUNT&#061;$(find \/tmp -type f 2&gt;\/dev\/null | wc -l)<br \/>\n \u00a0 \u00a0 \u00a0  log &#034;\/tmp\u76ee\u5f55:&#034;<br \/>\n \u00a0 \u00a0 \u00a0  log &#034;  \u603b\u5927\u5c0f: $TMP_SIZE&#034;<br \/>\n \u00a0 \u00a0 \u00a0  log &#034;  \u6587\u4ef6\u6570: $TMP_FILE_COUNT&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0# 7\u5929\u672a\u4f7f\u7528\u7684\u4e34\u65f6\u6587\u4ef6<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0OLD_TMP&#061;$(find \/tmp -type f -atime &#043;7 2&gt;\/dev\/null | wc -l)<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0if [ &#034;$OLD_TMP&#034; -gt 0 ]; then<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  log_warning &#034;  \u53d1\u73b0 $OLD_TMP \u4e2a\u8d85\u8fc77\u5929\u672a\u8bbf\u95ee\u7684\u4e34\u65f6\u6587\u4ef6&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  log &#034;  \u5360\u7528\u7a7a\u95f4TOP 10:&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0find \/tmp -type f -atime &#043;7 -exec ls -lh {} \\\\; 2&gt;\/dev\/null | sort -k5 -rh | head -10 | awk &#039;{print &#034; \u00a0  &#034; $9 &#034; (&#034; $5 &#034;)&#034;}&#039; | tee -a &#034;$REPORT_FILE&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0fi<br \/>\n \u00a0 \u00a0fi<br \/>\n \u00a0 \u00a0<br \/>\n \u00a0 \u00a0# \/var\/tmp\u68c0\u67e5<br \/>\n \u00a0 \u00a0if [ -d &#034;\/var\/tmp&#034; ]; then<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0VAR_TMP_SIZE&#061;$(du -sh \/var\/tmp 2&gt;\/dev\/null | awk &#039;{print $1}&#039;)<br \/>\n \u00a0 \u00a0 \u00a0  log -e &#034;\\\\n\/var\/tmp\u76ee\u5f55:&#034;<br \/>\n \u00a0 \u00a0 \u00a0  log &#034;  \u603b\u5927\u5c0f: $VAR_TMP_SIZE&#034;<br \/>\n \u00a0 \u00a0fi<br \/>\n}<br \/>\n\u200b<br \/>\n# 5. \u78c1\u76d8IO\u68c0\u67e5&#xff08;\u4e0d\u7528\u6539&#xff09;<br \/>\ncheck_disk_io() {<br \/>\n \u00a0  log &#034;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034;<br \/>\n \u00a0  log &#034;5. \u78c1\u76d8IO\u7edf\u8ba1&#034;<br \/>\n \u00a0  log &#034;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034;<br \/>\n \u00a0 \u00a0if command -v iostat &amp;&gt; \/dev\/null; then<br \/>\n \u00a0 \u00a0 \u00a0  log &#034;\u78c1\u76d8IO\u7edf\u8ba1(\u6700\u8fd11\u5206\u949f):&#034;<br \/>\n \u00a0 \u00a0 \u00a0  iostat -x 1 2 | tail -n &#043;4 | awk &#039;NF&#039; | tail -n &#043;2 | tee -a &#034;$REPORT_FILE&#034;<br \/>\n \u00a0 \u00a0else<br \/>\n \u00a0 \u00a0 \u00a0  log_warning &#034;\u672a\u5b89\u88c5iostat\u5de5\u5177&#xff08;\u6267\u884c&#xff1a;yum install sysstat \u5b89\u88c5&#xff09;&#034;<br \/>\n \u00a0 \u00a0fi<br \/>\n \u00a0 \u00a0<br \/>\n \u00a0 \u00a0# IO\u7b49\u5f85\u8fc7\u9ad8\u9884\u8b66&#xff08;\u8d85\u8fc720%&#xff09;<br \/>\n \u00a0 \u00a0IO_WAIT&#061;$(top -bn1 | grep &#034;Cpu(s)&#034; | awk &#039;{print $10}&#039; | sed &#039;s\/%wa,\/\/&#039;)<br \/>\n \u00a0  log -e &#034;\\\\n\u5f53\u524dIO\u7b49\u5f85: ${IO_WAIT}%&#034;<br \/>\n \u00a0 \u00a0if (( $(echo &#034;$IO_WAIT &gt; 20&#034; | bc -l) )); then<br \/>\n \u00a0 \u00a0 \u00a0  log_warning &#034;IO\u7b49\u5f85\u8fc7\u9ad8&#xff01;&#xff08;\u53ef\u80fd\u662f\u78c1\u76d8\u6027\u80fd\u4e0d\u8db3&#xff09;&#034;<br \/>\n \u00a0 \u00a0fi<br \/>\n}<br \/>\n\u200b<br \/>\n# 6. \u6e05\u7406\u5efa\u8bae&#xff08;\u65b0\u624b\u53ef\u76f4\u63a5\u590d\u5236\u6267\u884c&#xff09;&#xff08;\u4e0d\u7528\u6539&#xff09;<br \/>\ngenerate_cleanup_suggestions() {<br \/>\n \u00a0  log &#034;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034;<br \/>\n \u00a0  log &#034;6. \u78c1\u76d8\u6e05\u7406\u5efa\u8bae&#xff08;\u65b0\u624b\u590d\u5236\u547d\u4ee4\u6267\u884c&#xff09;&#034;<br \/>\n \u00a0  log &#034;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034;<br \/>\n \u00a0  log &#034;1. \u538b\u7f2930\u5929\u524d\u7684\u65e7\u65e5\u5fd7:&#034;<br \/>\n \u00a0  log &#034; \u00a0 find \/var\/log -type f -name &#039;*.log&#039; -mtime &#043;30 -exec gzip {} \\\\;&#034;<br \/>\n \u00a0  log -e &#034;\\\\n2. \u6e05\u74067\u5929\u524d\u7684\u4e34\u65f6\u6587\u4ef6:&#034;<br \/>\n \u00a0  log &#034; \u00a0 find \/tmp -type f -atime &#043;7 -delete&#034;<br \/>\n \u00a0  log -e &#034;\\\\n3. \u6e05\u7406yum\u7f13\u5b58&#xff08;CentOS&#xff09;:&#034;<br \/>\n \u00a0  log &#034; \u00a0 yum clean all&#034;<br \/>\n \u00a0  log -e &#034;\\\\n4. \u6e05\u7406Docker\u672a\u4f7f\u7528\u8d44\u6e90&#xff08;\u5982\u6709Docker&#xff09;:&#034;<br \/>\n \u00a0  log &#034; \u00a0 docker system prune -a&#034;<br \/>\n \u00a0  log -e &#034;\\\\n5. \u6e05\u7406journal\u65e5\u5fd7&#xff08;\u7cfb\u7edf\u65e5\u5fd7&#xff09;:&#034;<br \/>\n \u00a0  log &#034; \u00a0 journalctl &#8211;vacuum-time&#061;7d&#034;<br \/>\n}<br \/>\n\u200b<br \/>\n# \u4e3b\u51fd\u6570&#xff08;\u4e0d\u7528\u6539&#xff09;<br \/>\nmain() {<br \/>\n \u00a0 \u00a0echo &#034;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034;<br \/>\n \u00a0 \u00a0echo &#034; \u00a0  \u78c1\u76d8\u7a7a\u95f4\u6df1\u5ea6\u68c0\u67e5\u811a\u672c v1.5&#034;<br \/>\n \u00a0 \u00a0echo &#034;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034;<br \/>\n \u00a0 \u00a0echo -e &#034;\\\\n&#034;<br \/>\n \u00a0 \u00a0<br \/>\n \u00a0  check_disk_usage<br \/>\n \u00a0  check_inode_usage<br \/>\n \u00a0  check_log_files<br \/>\n \u00a0  check_temp_files<br \/>\n \u00a0  check_disk_io<br \/>\n \u00a0  generate_cleanup_suggestions<br \/>\n \u00a0 \u00a0<br \/>\n \u00a0  log -e &#034;\\\\n&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034;<br \/>\n \u00a0  log &#034;\u68c0\u67e5\u5b8c\u6210!&#034;<br \/>\n \u00a0  log &#034;\u62a5\u544a\u4fdd\u5b58\u81f3: $REPORT_FILE&#034;<br \/>\n \u00a0  log &#034;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034;<br \/>\n}<br \/>\n\u200b<br \/>\nmain &#034;$&#064;&#034; <\/p>\n<h4>\u65b0\u624b\u907f\u5751<\/h4>\n<li>\n<p>iostat\u7f3a\u5931&#xff1a;\u63d0\u793aiostat: command not found\u65f6&#xff0c;\u6267\u884cyum install sysstat&#xff08;CentOS&#xff09;\u6216apt install sysstat&#xff08;Ubuntu&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u6e05\u7406\u8c28\u614e&#xff1a;\u6267\u884c\u201c\u6e05\u7406\u5efa\u8bae\u201d\u4e2d\u7684\u547d\u4ee4\u524d&#xff0c;\u5148\u786e\u8ba4\u6587\u4ef6\u662f\u5426\u6709\u7528&#xff08;\u6bd4\u5982find \/tmp -type f -atime &#043;7\u5148\u67e5\u770b&#xff0c;\u518d\u5220&#xff09;\u3002<\/p>\n<\/li>\n<h3>\u811a\u672c3-7&#xff1a;\u6838\u5fc3\u811a\u672c&#xff08;\u7cbe\u7b80\u7248&#xff0c;\u91cd\u70b9\u6807\u914d\u7f6e\u548c\u6b65\u9aa4&#xff09;<\/h3>\n<h4>\u811a\u672c3&#xff1a;\u7f51\u7edc\u8fde\u63a5\u68c0\u67e5\u811a\u672c<\/h4>\n<h5>\u7528\u9014<\/h5>\n<p>\u68c0\u67e5\u7aef\u53e3\u76d1\u542c\u3001TCP\u8fde\u63a5\u72b6\u6001&#xff08;\u6bd4\u5982TIME_WAIT\u8fc7\u591a&#xff09;\u3001\u7f51\u7edc\u8fde\u901a\u6027&#xff08;DNS\/\u7f51\u5173\/\u5916\u7f51&#xff09;\u3002<\/p>\n<h5>\u4f7f\u7528\u6b65\u9aa4<\/h5>\n<ul>\n<li>\n<p>\u4fdd\u5b58\u4e3a network_check.sh&#xff0c;\u8d4b\u4e88\u6743\u9650&#xff1a;chmod &#043;x network_check.sh<\/p>\n<\/li>\n<li>\n<p>\u6267\u884c&#xff1a;.\/network_check.sh<\/p>\n<\/li>\n<li>\n<p>\u65b0\u624b\u6539\u914d\u7f6e\u533a&#xff1a;CRITICAL_PORTS&#061;(22 80 443 3306 6379)&#xff08;\u6dfb\u52a0\u81ea\u5df1\u7684\u5173\u952e\u7aef\u53e3&#xff09;<\/p>\n<\/li>\n<\/ul>\n<h5>\u6838\u5fc3\u4ee3\u7801&#xff08;\u5173\u952e\u90e8\u5206&#xff09;<\/h5>\n<p>#!\/bin\/bash<br \/>\n################################################################################<br \/>\n# \u811a\u672c\u540d\u79f0: network_check.sh<br \/>\n# \u529f\u80fd\u63cf\u8ff0: \u7f51\u7edc\u8fde\u63a5\u548c\u7aef\u53e3\u68c0\u67e5&#xff08;\u65b0\u624b\u6539CRITICAL_PORTS&#xff01;&#xff09;<br \/>\n################################################################################<br \/>\n\u200b<br \/>\n# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; \u65b0\u624b\u5fc5\u6539&#xff1a;\u914d\u7f6e\u533a &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\nREPORT_FILE&#061;&#034;\/var\/log\/network_check_$(date &#043;%Y%m%d_%H%M%S).log&#034;<br \/>\nTIME_WAIT_WARNING&#061;5000 \u00a0# TIME_WAIT\u8d85\u8fc75000\u9884\u8b66<br \/>\nESTABLISHED_WARNING&#061;10000 # \u6d3b\u52a8\u8fde\u63a5\u8d85\u8fc710000\u9884\u8b66<br \/>\nCRITICAL_PORTS&#061;(22 80 443 3306 6379 8080) # \u5173\u952e\u7aef\u53e3&#xff08;\u5982MySQL:3306&#xff0c;Redis:6379&#xff09;<br \/>\n# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n\u200b<br \/>\n# \u989c\u8272\u548c\u65e5\u5fd7\u51fd\u6570&#xff08;\u540c\u524d&#xff0c;\u4e0d\u7528\u6539&#xff09;<br \/>\nRED&#061;&#039;\\\\033[0;31m&#039;<br \/>\nGREEN&#061;&#039;\\\\033[0;32m&#039;<br \/>\nYELLOW&#061;&#039;\\\\033[1;33m&#039;<br \/>\nNC&#061;&#039;\\\\033[0m&#039;<br \/>\nlog() { echo &#034;[$(date &#043;&#034;%Y-%m-%d %H:%M:%S&#034;)] $1&#034; | tee -a &#034;$REPORT_FILE&#034;; }<br \/>\nlog_warning() { echo -e &#034;${YELLOW}[WARNING] $1${NC}&#034; | tee -a &#034;$REPORT_FILE&#034;; }<br \/>\nlog_ok() { echo -e &#034;${GREEN}[OK] $1${NC}&#034; | tee -a &#034;$REPORT_FILE&#034;; }<br \/>\n\u200b<br \/>\n# \u5173\u952e\u7aef\u53e3\u68c0\u67e5&#xff08;\u6838\u5fc3\u529f\u80fd&#xff09;<br \/>\ncheck_listening_ports() {<br \/>\n \u00a0  log &#034;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034;<br \/>\n \u00a0  log &#034;3. \u5173\u952e\u7aef\u53e3\u68c0\u67e5&#034;<br \/>\n \u00a0  log &#034;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034;<br \/>\n \u00a0  log &#034;\u5f53\u524d\u76d1\u542c\u7aef\u53e3:&#034;<br \/>\n \u00a0  netstat -tulnp | grep LISTEN | tee -a &#034;$REPORT_FILE&#034;<br \/>\n \u00a0  log -e &#034;\\\\n\u5173\u952e\u7aef\u53e3\u72b6\u6001:&#034;<br \/>\n \u00a0 \u00a0for port in &#034;${CRITICAL_PORTS[&#064;]}&#034;; do<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0if netstat -tuln | grep -q &#034;:$port &#034;; then<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0PID&#061;$(netstat -tulnp 2&gt;\/dev\/null | grep &#034;:$port &#034; | awk &#039;{print $7}&#039; | cut -d&#039;\/&#039; -f1)<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0PROCESS&#061;$(netstat -tulnp 2&gt;\/dev\/null | grep &#034;:$port &#034; | awk &#039;{print $7}&#039; | cut -d&#039;\/&#039; -f2)<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  log_ok &#034;\u7aef\u53e3 $port: \u76d1\u542c\u4e2d&#xff08;\u8fdb\u7a0b:$PROCESS PID:$PID&#xff09;&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0else<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  log_warning &#034;\u7aef\u53e3 $port: \u672a\u76d1\u542c&#xff08;\u670d\u52a1\u53ef\u80fd\u672a\u542f\u52a8&#xff09;&#034;<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0fi<br \/>\n \u00a0 \u00a0done<br \/>\n}<br \/>\n\u200b<br \/>\n# \u5176\u4ed6\u51fd\u6570&#xff08;\u7f51\u7edc\u63a5\u53e3\u3001TCP\u8fde\u63a5\u3001\u8fde\u901a\u6027&#xff09;\u7701\u7565&#xff0c;\u5b8c\u6574\u4ee3\u7801\u540c\u524d\u903b\u8f91<br \/>\n# \u4e3b\u51fd\u6570&#xff08;\u8c03\u7528check_listening_ports\u7b49&#xff09;<br \/>\nmain() {<br \/>\n \u00a0 \u00a0echo &#034;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034;<br \/>\n \u00a0 \u00a0echo &#034; \u00a0  \u7f51\u7edc\u72b6\u6001\u68c0\u67e5\u811a\u672c v1.0&#034;<br \/>\n \u00a0 \u00a0echo &#034;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034;<br \/>\n \u00a0  check_network_interfaces<br \/>\n \u00a0  check_tcp_connections<br \/>\n \u00a0  check_listening_ports<br \/>\n \u00a0  check_network_connectivity<br \/>\n \u00a0  log -e &#034;\\\\n\u68c0\u67e5\u5b8c\u6210! \u62a5\u544a: $REPORT_FILE&#034;<br \/>\n}<br \/>\nmain &#034;$&#064;&#034; <\/p>\n<h4>\u811a\u672c4&#xff1a;\u5e94\u7528\u8fdb\u7a0b\u5065\u5eb7\u68c0\u67e5\u811a\u672c<\/h4>\n<h5>\u7528\u9014<\/h5>\n<p>\u76d1\u63a7\u5173\u952e\u8fdb\u7a0b&#xff08;Nginx\/MySQL\/Redis&#xff09;\u3001\u7aef\u53e3\u3001HTTP\u63a5\u53e3\u54cd\u5e94&#xff08;\u6bd4\u5982\u5065\u5eb7\u68c0\u67e5\u63a5\u53e3&#xff09;\u3002<\/p>\n<h5>\u65b0\u624b\u6539\u914d\u7f6e\u533a<\/h5>\n<p># \u5173\u952e\u8fdb\u7a0b&#xff08;\u8fdb\u7a0b\u540d|\u7aef\u53e3&#xff0c;\u5982&#034;nginx|80,443&#034;&#xff09;<br \/>\ndeclare -A CRITICAL_PROCESSES&#061;(<br \/>\n \u00a0  [&#034;nginx&#034;]&#061;&#034;nginx|80,443&#034;<br \/>\n \u00a0  [&#034;mysql&#034;]&#061;&#034;mysqld|3306&#034;<br \/>\n \u00a0  [&#034;redis&#034;]&#061;&#034;redis-server|6379&#034;<br \/>\n \u00a0  [&#034;java&#034;]&#061;&#034;java|8080&#034; # \u5982SpringBoot\u5e94\u7528<br \/>\n)<br \/>\n\u200b<br \/>\n# HTTP\u63a5\u53e3&#xff08;\u5982\u5065\u5eb7\u68c0\u67e5\u63a5\u53e3&#xff09;<br \/>\ndeclare -A HTTP_ENDPOINTS&#061;(<br \/>\n \u00a0  [&#034;\u4e3b\u9875&#034;]&#061;&#034;http:\/\/localhost\/&#034;<br \/>\n \u00a0  [&#034;\u5065\u5eb7\u68c0\u67e5&#034;]&#061;&#034;http:\/\/localhost:8080\/health&#034;<br \/>\n \u00a0  [&#034;API\u72b6\u6001&#034;]&#061;&#034;http:\/\/localhost:8080\/api\/status&#034;<br \/>\n) <\/p>\n<h4>\u811a\u672c5&#xff1a;\u5b89\u5168\u57fa\u7ebf\u68c0\u67e5\u811a\u672c<\/h4>\n<h5>\u7528\u9014<\/h5>\n<p>\u68c0\u67e5\u8d26\u6237\u5b89\u5168&#xff08;\u7a7a\u5bc6\u7801\u3001\u591aroot\u8d26\u6237&#xff09;\u3001SSH\u914d\u7f6e&#xff08;\u7981\u6b62root\u767b\u5f55\u3001\u7981\u7528\u5bc6\u7801\u767b\u5f55&#xff09;\u3001\u6587\u4ef6\u6743\u9650&#xff08;\/etc\/passwd\u7b49\u5173\u952e\u6587\u4ef6&#xff09;\u3002<\/p>\n<h5>\u6838\u5fc3\u529f\u80fd<\/h5>\n<ul>\n<li>\n<p>\u68c0\u67e5\u7a7a\u5bc6\u7801\u8d26\u6237\u3001UID&#061;0\u7684\u8d26\u6237&#xff08;\u591aroot\u98ce\u9669&#xff09;<\/p>\n<\/li>\n<li>\n<p>\u68c0\u67e5SSH\u662f\u5426\u5141\u8bb8root\u767b\u5f55\u3001\u5bc6\u7801\u767b\u5f55&#xff08;\u4e0d\u5b89\u5168&#xff09;<\/p>\n<\/li>\n<li>\n<p>\u68c0\u67e5\u5173\u952e\u6587\u4ef6\u6743\u9650&#xff08;\u5982\/etc\/shadow\u6743\u9650\u5e94\u4e3a000&#xff09;<\/p>\n<\/li>\n<\/ul>\n<h4>\u811a\u672c6&#xff1a;MySQL\u6570\u636e\u5e93\u68c0\u67e5\u811a\u672c<\/h4>\n<h5>\u7528\u9014<\/h5>\n<p>\u68c0\u67e5MySQL\u8fde\u63a5\u6570\u3001\u6162\u67e5\u8be2\u3001\u4e3b\u4ece\u590d\u5236\u3001InnoDB\u7f13\u51b2\u6c60\u547d\u4e2d\u7387\u3002<\/p>\n<h5>\u65b0\u624b\u5fc5\u6539\u914d\u7f6e<\/h5>\n<p># MySQL\u8fde\u63a5\u4fe1\u606f&#xff08;\u6539\u81ea\u5df1\u7684\u7528\u6237\u540d\u3001\u5bc6\u7801\u3001\u5730\u5740&#xff09;<br \/>\nMYSQL_USER&#061;&#034;monitor&#034; \u00a0 # MySQL\u76d1\u63a7\u8d26\u6237&#xff08;\u9700\u63d0\u524d\u521b\u5efa&#xff0c;\u7ed9SELECT\u6743\u9650&#xff09;<br \/>\nMYSQL_PASS&#061;&#034;your_pass&#034; # \u5bc6\u7801<br \/>\nMYSQL_HOST&#061;&#034;localhost&#034; # \u6570\u636e\u5e93\u5730\u5740<br \/>\nMYSQL_PORT&#061;&#034;3306&#034; \u00a0 \u00a0 \u00a0# \u7aef\u53e3 <\/p>\n<h4>\u811a\u672c7&#xff1a;\u6279\u91cf\u670d\u52a1\u5668\u5de1\u68c0\u811a\u672c<\/h4>\n<h5>\u7528\u9014<\/h5>\n<p>\u5e76\u53d1\u5de1\u68c0\u591a\u53f0\u670d\u52a1\u5668&#xff08;\u6bd4\u5982200\u53f0&#xff09;&#xff0c;\u751f\u6210HTML\u6c47\u603b\u62a5\u544a&#xff08;\u5e26\u989c\u8272&#xff0c;\u53ef\u6d4f\u89c8\u5668\u6253\u5f00&#xff09;\u3002<\/p>\n<h5>\u65b0\u624b\u4f7f\u7528\u6b65\u9aa4<\/h5>\n<h6>\u51c6\u5907\u670d\u52a1\u5668\u5217\u8868\u6587\u4ef6 servers.txt&#xff08;\u683c\u5f0f\u5982\u4e0b&#xff09;&#xff1a;<\/h6>\n<p># Web\u670d\u52a1\u5668<br \/>\n192.168.1.10<br \/>\n192.168.1.11<br \/>\n# \u6570\u636e\u5e93\u670d\u52a1\u5668<br \/>\n192.168.1.30 <\/p>\n<h6>\u6539\u914d\u7f6e\u533a&#xff08;SSH\u4fe1\u606f&#xff09;&#xff1a;<\/h6>\n<p>SSH_USER&#061;&#034;root&#034; \u00a0 \u00a0 \u00a0 \u00a0 \u00a0# SSH\u7528\u6237\u540d<br \/>\nSSH_KEY&#061;&#034;~\/.ssh\/id_rsa&#034; \u00a0# SSH\u79c1\u94a5\u8def\u5f84&#xff08;\u514d\u5bc6\u767b\u5f55\u7528&#xff09;<br \/>\nCONCURRENT&#061;10 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0# \u5e76\u53d1\u6570&#xff08;\u540c\u65f6\u68c0\u67e510\u53f0&#xff09;<br \/>\nCHECK_SCRIPT&#061;&#034;system_health_check.sh&#034; # \u8981\u6279\u91cf\u6267\u884c\u7684\u811a\u672c <\/p>\n<h6>\u6267\u884c&#xff1a;<\/h6>\n<p>.\/batch_check_scheduler.sh&#xff0c;\u62a5\u544a\u5b58 \/var\/log\/batch_check_xxx\/&#xff0c;\u6253\u5f00summary.html\u770b\u6c47\u603b\u3002<\/p>\n<h3>\u65b0\u624b\u5fc5\u5907\u603b\u7ed3<\/h3>\n<h4>\u5e38\u7528\u547d\u4ee4<\/h4>\n<ul>\n<li>\n<p>\u8d4b\u4e88\u811a\u672c\u6743\u9650&#xff1a;chmod &#043;x \u811a\u672c\u540d.sh<\/p>\n<\/li>\n<li>\n<p>\u6267\u884c\u811a\u672c&#xff1a;.\/\u811a\u672c\u540d.sh&#xff08;root\u7528\u6237\u7528sudo .\/\u811a\u672c\u540d.sh&#xff09;<\/p>\n<\/li>\n<li>\n<p>\u5b9a\u65f6\u6267\u884c&#xff1a;crontab -e&#xff0c;\u6dfb\u52a00 8 * * * \/path\/to\/\u811a\u672c\u540d.sh&#xff08;\u6bcf\u59298\u70b9&#xff09;<\/p>\n<\/li>\n<li>\n<p>\u67e5\u770b\u62a5\u544a&#xff1a;cat \/var\/log\/\u811a\u672c\u540d_20251022_083000.log<\/p>\n<\/li>\n<\/ul>\n<h4>\u5de1\u68c0\u9891\u7387\u5efa\u8bae<\/h4>\n<ul>\n<li>\n<p>\u7cfb\u7edf\u5065\u5eb7&#xff08;\u811a\u672c1&#xff09;&#xff1a;\u6bcf\u59291\u6b21&#xff08;\u65e98\u70b9&#xff09;<\/p>\n<\/li>\n<li>\n<p>\u78c1\u76d8\u68c0\u67e5&#xff08;\u811a\u672c2&#xff09;&#xff1a;\u6bcf\u59291\u6b21<\/p>\n<\/li>\n<li>\n<p>\u8fdb\u7a0b\u68c0\u67e5&#xff08;\u811a\u672c4&#xff09;&#xff1a;\u6838\u5fc3\u4e1a\u52a1\u6bcf\u5c0f\u65f61\u6b21<\/p>\n<\/li>\n<li>\n<p>\u5b89\u5168\u68c0\u67e5&#xff08;\u811a\u672c5&#xff09;&#xff1a;\u6bcf\u54681\u6b21<\/p>\n<\/li>\n<li>\n<p>\u6279\u91cf\u5de1\u68c0&#xff08;\u811a\u672c7&#xff09;&#xff1a;\u96c6\u7fa4\u6bcf\u59291\u6b21<\/p>\n<\/li>\n<\/ul>\n<h4>\u907f\u5751\u603b\u89c8<\/h4>\n<ul>\n<li>\n<p>\u6240\u6709\u811a\u672c\u5c3d\u91cf\u7528root\u6267\u884c&#xff0c;\u5426\u5219\u68c0\u67e5\u4e0d\u5b8c\u6574<\/p>\n<\/li>\n<li>\n<p>\u547d\u4ee4\u7f3a\u5931\u65f6&#xff0c;\u6839\u636e\u63d0\u793a\u5b89\u88c5\u4f9d\u8d56&#xff08;\u5982yum install net-tools sysstat&#xff09;<\/p>\n<\/li>\n<li>\n<p>\u4fee\u6539\u914d\u7f6e\u533a\u65f6&#xff0c;\u8def\u5f84\u3001\u8d26\u6237\u3001\u5bc6\u7801\u8981\u548c\u5b9e\u9645\u73af\u5883\u4e00\u81f4\u2022<\/p>\n<\/li>\n<li>\n<p>\u6e05\u7406\u6587\u4ef6\u524d&#xff0c;\u5148\u67e5\u770b&#xff08;\u5982find \/tmp -type f -atime &#043;7&#xff09;\u518d\u5220\u9664<\/p>\n<\/li>\n<\/ul>\n<p><span class=\"link-card-box\"><span class=\"link-title\">\u539f\u6587\u94fe\u63a5<\/span><span class=\"link-link\"><img decoding=\"async\" class=\"link-link-icon\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260205205657-69850419aa3c5.png\" \/>https:\/\/gegeblog.top\/<\/span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u6574\u7406\u4e867\u4e2a\u751f\u4ea7\u7ea7Shell\u5de1\u68c0\u811a\u672c&#xff0c;\u8986\u76d6\u7cfb\u7edf\u5065\u5eb7\u3001\u78c1\u76d8\u3001\u7f51\u7edc\u3001\u8fdb\u7a0b\u3001\u5b89\u5168\u3001\u6570\u636e\u5e93\u3001\u6279\u91cf\u5de1\u68c0\u573a\u666f\u3002\u6bcf\u4e2a\u811a\u672c\u90fd\u6807\u6ce8\u4e86\u914d\u7f6e\u4fee\u6539\u70b9\u3001\u4f7f\u7528\u6b65\u9aa4\u548c\u65b0\u624b\u907f\u5751\u63d0\u793a&#xff0c;\u590d\u5236\u4ee3\u7801\u5c31\u80fd\u7528&#xff0c;\u9002\u5408\u8fd0\u7ef4\u65b0\u624b\u5feb\u901f\u4e0a\u624b\u3002<br \/>\n\u811a\u672c\u603b\u89c8&#xff1a;\u6309\u9700\u6c42\u9009\u811a\u672c<br \/>\n\u811a\u672c\u5e8f\u53f7\u811a\u672c\u540d\u79f0\u6838\u5fc3\u7528\u9014\u9002\u7528\u573a\u666f1\u7cfb\u7edf\u5065\u5eb7\u68c0\u67e5\u811a\u672c\u68c0\u67e5CPU\u3001\u5185\u5b58\u3001\u78c1\u76d8\u3001\u7f51\u7edc\u3001\u8fdb\u7a0b\u7b49\u57fa\u7840\u8d44\u6e90\u65e5\u5e38\u670d\u52a1\u5668\u5065\u5eb7\u5de1\u68c0&#xff08;\u6bcf\u59291\u6b21&#xff09;2\u78c1\u76d8\u7a7a\u95f4\u6df1\u5ea6\u68c0\u67e5\u811a\u672c\u5b9a\u4f4d\u5927\u6587\u4ef6\u3001\u65e5\u5fd7\u5806\u79ef\u3001Inod<\/p>\n","protected":false},"author":2,"featured_media":72585,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[230,1468,77,190],"topic":[],"class_list":["post-72586","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-php","tag-shell","tag-ssh","tag-190"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>7\u4e2aShell\u670d\u52a1\u5668\u5de1\u68c0\u811a\u672c\uff5c\u65b0\u624b\u76f4\u63a5\u590d\u5236\u53ef\u7528\uff08\u9644\u8be6\u7ec6\u6b65\u9aa4\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/72586.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"7\u4e2aShell\u670d\u52a1\u5668\u5de1\u68c0\u811a\u672c\uff5c\u65b0\u624b\u76f4\u63a5\u590d\u5236\u53ef\u7528\uff08\u9644\u8be6\u7ec6\u6b65\u9aa4\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u672c\u6587\u6574\u7406\u4e867\u4e2a\u751f\u4ea7\u7ea7Shell\u5de1\u68c0\u811a\u672c&#xff0c;\u8986\u76d6\u7cfb\u7edf\u5065\u5eb7\u3001\u78c1\u76d8\u3001\u7f51\u7edc\u3001\u8fdb\u7a0b\u3001\u5b89\u5168\u3001\u6570\u636e\u5e93\u3001\u6279\u91cf\u5de1\u68c0\u573a\u666f\u3002\u6bcf\u4e2a\u811a\u672c\u90fd\u6807\u6ce8\u4e86\u914d\u7f6e\u4fee\u6539\u70b9\u3001\u4f7f\u7528\u6b65\u9aa4\u548c\u65b0\u624b\u907f\u5751\u63d0\u793a&#xff0c;\u590d\u5236\u4ee3\u7801\u5c31\u80fd\u7528&#xff0c;\u9002\u5408\u8fd0\u7ef4\u65b0\u624b\u5feb\u901f\u4e0a\u624b\u3002 \u811a\u672c\u603b\u89c8&#xff1a;\u6309\u9700\u6c42\u9009\u811a\u672c \u811a\u672c\u5e8f\u53f7\u811a\u672c\u540d\u79f0\u6838\u5fc3\u7528\u9014\u9002\u7528\u573a\u666f1\u7cfb\u7edf\u5065\u5eb7\u68c0\u67e5\u811a\u672c\u68c0\u67e5CPU\u3001\u5185\u5b58\u3001\u78c1\u76d8\u3001\u7f51\u7edc\u3001\u8fdb\u7a0b\u7b49\u57fa\u7840\u8d44\u6e90\u65e5\u5e38\u670d\u52a1\u5668\u5065\u5eb7\u5de1\u68c0&#xff08;\u6bcf\u59291\u6b21&#xff09;2\u78c1\u76d8\u7a7a\u95f4\u6df1\u5ea6\u68c0\u67e5\u811a\u672c\u5b9a\u4f4d\u5927\u6587\u4ef6\u3001\u65e5\u5fd7\u5806\u79ef\u3001Inod\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/72586.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-05T20:56:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260205205657-69850419aa3c5.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"13 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/72586.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/72586.html\",\"name\":\"7\u4e2aShell\u670d\u52a1\u5668\u5de1\u68c0\u811a\u672c\uff5c\u65b0\u624b\u76f4\u63a5\u590d\u5236\u53ef\u7528\uff08\u9644\u8be6\u7ec6\u6b65\u9aa4\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-05T20:56:58+00:00\",\"dateModified\":\"2026-02-05T20:56:58+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/72586.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/72586.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/72586.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"7\u4e2aShell\u670d\u52a1\u5668\u5de1\u68c0\u811a\u672c\uff5c\u65b0\u624b\u76f4\u63a5\u590d\u5236\u53ef\u7528\uff08\u9644\u8be6\u7ec6\u6b65\u9aa4\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"7\u4e2aShell\u670d\u52a1\u5668\u5de1\u68c0\u811a\u672c\uff5c\u65b0\u624b\u76f4\u63a5\u590d\u5236\u53ef\u7528\uff08\u9644\u8be6\u7ec6\u6b65\u9aa4\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/72586.html","og_locale":"zh_CN","og_type":"article","og_title":"7\u4e2aShell\u670d\u52a1\u5668\u5de1\u68c0\u811a\u672c\uff5c\u65b0\u624b\u76f4\u63a5\u590d\u5236\u53ef\u7528\uff08\u9644\u8be6\u7ec6\u6b65\u9aa4\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u672c\u6587\u6574\u7406\u4e867\u4e2a\u751f\u4ea7\u7ea7Shell\u5de1\u68c0\u811a\u672c&#xff0c;\u8986\u76d6\u7cfb\u7edf\u5065\u5eb7\u3001\u78c1\u76d8\u3001\u7f51\u7edc\u3001\u8fdb\u7a0b\u3001\u5b89\u5168\u3001\u6570\u636e\u5e93\u3001\u6279\u91cf\u5de1\u68c0\u573a\u666f\u3002\u6bcf\u4e2a\u811a\u672c\u90fd\u6807\u6ce8\u4e86\u914d\u7f6e\u4fee\u6539\u70b9\u3001\u4f7f\u7528\u6b65\u9aa4\u548c\u65b0\u624b\u907f\u5751\u63d0\u793a&#xff0c;\u590d\u5236\u4ee3\u7801\u5c31\u80fd\u7528&#xff0c;\u9002\u5408\u8fd0\u7ef4\u65b0\u624b\u5feb\u901f\u4e0a\u624b\u3002 \u811a\u672c\u603b\u89c8&#xff1a;\u6309\u9700\u6c42\u9009\u811a\u672c \u811a\u672c\u5e8f\u53f7\u811a\u672c\u540d\u79f0\u6838\u5fc3\u7528\u9014\u9002\u7528\u573a\u666f1\u7cfb\u7edf\u5065\u5eb7\u68c0\u67e5\u811a\u672c\u68c0\u67e5CPU\u3001\u5185\u5b58\u3001\u78c1\u76d8\u3001\u7f51\u7edc\u3001\u8fdb\u7a0b\u7b49\u57fa\u7840\u8d44\u6e90\u65e5\u5e38\u670d\u52a1\u5668\u5065\u5eb7\u5de1\u68c0&#xff08;\u6bcf\u59291\u6b21&#xff09;2\u78c1\u76d8\u7a7a\u95f4\u6df1\u5ea6\u68c0\u67e5\u811a\u672c\u5b9a\u4f4d\u5927\u6587\u4ef6\u3001\u65e5\u5fd7\u5806\u79ef\u3001Inod","og_url":"https:\/\/www.wsisp.com\/helps\/72586.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-05T20:56:58+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260205205657-69850419aa3c5.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"13 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/72586.html","url":"https:\/\/www.wsisp.com\/helps\/72586.html","name":"7\u4e2aShell\u670d\u52a1\u5668\u5de1\u68c0\u811a\u672c\uff5c\u65b0\u624b\u76f4\u63a5\u590d\u5236\u53ef\u7528\uff08\u9644\u8be6\u7ec6\u6b65\u9aa4\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-05T20:56:58+00:00","dateModified":"2026-02-05T20:56:58+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/72586.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/72586.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/72586.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"7\u4e2aShell\u670d\u52a1\u5668\u5de1\u68c0\u811a\u672c\uff5c\u65b0\u624b\u76f4\u63a5\u590d\u5236\u53ef\u7528\uff08\u9644\u8be6\u7ec6\u6b65\u9aa4\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/72586","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=72586"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/72586\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/72585"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=72586"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=72586"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=72586"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=72586"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}