{"id":413,"date":"2018-01-13T04:28:35","date_gmt":"2018-01-13T04:28:35","guid":{"rendered":"http:\/\/www.liutianfeng.com\/?p=413"},"modified":"2018-01-13T04:36:02","modified_gmt":"2018-01-13T04:36:02","slug":"%e5%bf%ab%e9%80%9f%e5%ae%9a%e4%bd%8d%e6%83%b3%e8%a6%81%e6%9f%a5%e8%af%a2%e7%9a%84%e6%97%a5%e5%bf%97%e8%b7%af%e5%be%84%e7%9a%84%e6%96%b9%e6%a1%88-centos","status":"publish","type":"post","link":"https:\/\/www.liutianfeng.com\/?p=413","title":{"rendered":"\u5feb\u901f\u5b9a\u4f4d\u60f3\u8981\u67e5\u8be2\u7684\u65e5\u5fd7\u8def\u5f84\u7684\u65b9\u6848 &#8211; Centos"},"content":{"rendered":"<p>\u4eca\u5929\u7a81\u7136\u60f3\u5230\uff0c\u5982\u679c\u6211\u4eec\u914d\u7f6e\u7684\u670d\u52a1\u4e0d\u5c11\uff0c\u5bb9\u6613\u8bb0\u4e0d\u4f4f\u65e5\u5fd7\u7684\u4f4d\u7f6e\uff0c\u5f53\u7136\uff0c\u505a\u4e3a\u8fd0\u7ef4\uff0c\u65e5\u5fd7\u7684\u4f4d\u7f6e\u662f\u5fc5\u987b\u8981\u8bb0\u4f4f\u7684\u3002\u53ef\u5982\u679c\u4e00\u65f6\u5fd8\u8bb0\u7684\u65f6\u5019\uff0c\u518d\u7528find\u547d\u4ee4\u67e5\u627e\uff0c\u6216\u8005\u67e5\u770b\u914d\u7f6e\u6587\u4ef6\uff08\u914d\u7f6e\u6587\u4ef6\u7684\u4f4d\u7f6e\u4e5f\u53ef\u80fd\u5fd8\u8bb0\u54e6\uff0c\/\u5077\u7b11\uff09\uff0c\u90a3\u5c31\u6bd4\u8f83\u8d39\u65f6\u4e86\u3002<\/p>\n<p>\u8fd9\u91cc\uff0c\u6211\u60f3\u5230\u4e00\u4e2a\u6bd4\u8f83\u597d\u7528\u7684\u65b9\u6cd5\u3002<\/p>\n<p>\u6211\u4eec\u53ef\u4ee5\u5c06\u6240\u6709\u670d\u52a1\u5668\u4e2d\u7684\u670d\u52a1\u65e5\u5fd7\u8def\u5f84\uff0c\u7f16\u5199\u5165\u4e00\u4e2a\u6587\u4ef6\uff0c\u5199\u5165\u6240\u6709\u670d\u52a1\u7684\u65e5\u5fd7\u8def\u5f84\uff0c\u4f8b\u5982\uff1a<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\"># vim ~\/tools\/log_path.txt\r\nmysql-err: \/data\/mysql\/mysql-err\r\nmysql: \/usr\/local\/mysql\/logs\/mysql-log\r\nnginx-err: \/usr\/local\/nginx\/logs\/nginx.err\r\nngxin: \/usr\/local\/nginx\/logs\/nginx.log\r\n... ...\r\n... ...<\/code><\/pre>\n<p>\u4e00\u65e6\u6709\u4e86\u65b0\u7684\u670d\u52a1\uff0c\u53ea\u8981\u5c06\u8fd9\u4e2a\u6587\u4ef6\u4e30\u5bcc\u4e00\u4e0b\u3002<\/p>\n<p>\u4e0b\u9762\u5c31\u505a\u4e00\u4e2a\u811a\u672c\uff0c\u5e76\u5efa\u7acb\u522b\u540d\uff1a<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\"># vim ~\/find_log.sh\r\n#!\/bin\/bash\r\n# Find log automatically.\r\n# Date: 2018-01-12\r\n# Script Name: find_log.sh\r\n# Author: Liemer_Lius\r\nif [ $# -lt 1 ]; then\r\n echo \"A service name should be given.\"\r\n exit 4\r\nfi\r\nif grep $1 ~\/tools\/log_path.txt &amp;&gt; \/dev\/null; then\r\n echo -e \"\\033[31mLogpath:\\033[0m\"\r\n grep --color=auto ^$1 ~\/tools\/log_path.txt\r\nelse\r\n echo \"There is no information about the log you have given.\"\r\n exit 5\r\nfi\r\n<\/code><\/pre>\n<p>\u5efa\u7acb\u522b\u540d\uff1a<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\"># echo \"alias findlog='\/bin\/bash ~\/find_log.sh'\" &gt;&gt; ~\/.bashrc\r\n# source .bashrc\r\n# findlog mysql\r\n<span style=\"color: #ff0000;\"><strong>Logpath<\/strong>:<\/span>\r\n<strong><span style=\"color: #ff0000;\">mysql<\/span><\/strong>-err: \/data\/mysql\/mysql-err\r\n<strong><span style=\"color: #ff0000;\">mysql<\/span><\/strong>: \/usr\/local\/mysql\/logs\/mysql-log<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>\u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff1a<a href=\"https:\/\/www.liutianfeng.com\">liutianfeng.com<\/a> &raquo; <a href=\"https:\/\/www.liutianfeng.com\/?p=413\">\u5feb\u901f\u5b9a\u4f4d\u60f3\u8981\u67e5\u8be2\u7684\u65e5\u5fd7\u8def\u5f84\u7684\u65b9\u6848 &#8211; Centos<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>\u4eca\u5929\u7a81\u7136\u60f3\u5230\uff0c\u5982\u679c\u6211\u4eec\u914d\u7f6e\u7684\u670d\u52a1\u4e0d\u5c11\uff0c\u5bb9\u6613\u8bb0\u4e0d\u4f4f\u65e5\u5fd7\u7684\u4f4d\u7f6e\uff0c\u5f53\u7136\uff0c\u505a\u4e3a\u8fd0\u7ef4\uff0c\u65e5\u5fd7\u7684\u4f4d\u7f6e\u662f\u5fc5\u987b\u8981\u8bb0\u4f4f\u7684\u3002\u53ef\u5982\u679c\u4e00 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.liutianfeng.com\/index.php?rest_route=\/wp\/v2\/posts\/413"}],"collection":[{"href":"https:\/\/www.liutianfeng.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.liutianfeng.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.liutianfeng.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.liutianfeng.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=413"}],"version-history":[{"count":5,"href":"https:\/\/www.liutianfeng.com\/index.php?rest_route=\/wp\/v2\/posts\/413\/revisions"}],"predecessor-version":[{"id":418,"href":"https:\/\/www.liutianfeng.com\/index.php?rest_route=\/wp\/v2\/posts\/413\/revisions\/418"}],"wp:attachment":[{"href":"https:\/\/www.liutianfeng.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=413"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.liutianfeng.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=413"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.liutianfeng.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=413"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}