{"id":4014,"date":"2019-07-18T19:05:56","date_gmt":"2019-07-18T11:05:56","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=4014"},"modified":"2019-07-18T19:05:57","modified_gmt":"2019-07-18T11:05:57","slug":"logsave","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/logsave","title":{"rendered":"logsave\u547d\u4ee4 – \u5c06\u8f93\u51fa\u4fe1\u606f\u4fdd\u5b58\u5230\u6307\u5b9a\u7684\u65e5\u5fd7\u6587\u4ef6\u4e2d"},"content":{"rendered":"\n
logsave\u7a0b\u5e8f\u5c06\u4f7f\u7528\u6307\u5b9a\u7684\u53c2\u6570\u6267\u884ccmd_prog\uff0c\u5e76\u5c06\u5176\u8f93\u51fa\u7684\u526f\u672c\u4fdd\u5b58\u5230logfile\u3002\u5982\u679c\u65e5\u5fd7\u6587\u4ef6\u7684\u5305\u542b\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c\u5219logsave\u5c06\u5728\u5185\u5b58\u4e2d\u7d2f\u79ef\u8f93\u51fa\uff0c\u76f4\u5230\u53ef\u4ee5\u5c06\u5176\u5199\u51fa\u3002\u8f93\u51fa\u7684\u526f\u672c\u4e5f\u5c06\u5199\u5165\u6807\u51c6\u8f93\u51fa\u3002<\/p>\n\n\n\n
\u5982\u679c\u547d\u4ee4prog\u662f\u5355\u4e2a\u8fde\u5b57\u7b26\uff08\u201c-\u201d\uff09\uff0c\u90a3\u4e48log save\u5c06\u4ece\u6807\u51c6\u8f93\u5165\u4e2d\u83b7\u53d6\u5176\u8f93\u5165\u5e76\u5c06\u5176\u4fdd\u5b58\u5728\u65e5\u5fd7\u6587\u4ef6\u4e2d\uff0c\u800c\u4e0d\u662f\u6267\u884c\u7a0b\u5e8f\uff0clogsave\u5bf9\u4e8e\u4fdd\u5b58\u521d\u59cb\u542f\u52a8\u811a\u672c\u7684\u8f93\u51fa\u975e\u5e38\u6709\u7528\uff0c\u76f4\u5230\/var\u5206\u533a\u88ab\u88c5\u5165\uff0c\u56e0\u6b64\u8f93\u51fa\u53ef\u4ee5\u5199\u5165\/var\/log\u3002<\/p>\n\n\n\n
\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>logsave [\u53c2\u6570]<\/p>\n\n\n\n \u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n \u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n \u4fdd\u5b58\u8f93\u51fa\u7684\u65e5\u5fd7\u4fe1\u606f\u5230\u6307\u5b9a\u7684\u6587\u4ef6\u4e2d\uff1a<\/p>\n\n\n\n \u4f7f\u7528-a\u53c2\u6570\u5f80\u65e5\u5fd7\u6587\u4ef6\u4e2d\u8ffd\u52a0\u4fe1\u606f\uff1a<\/p>\n\n\n\n logsave\u7a0b\u5e8f\u5c06\u4f7f\u7528\u6307\u5b9a\u7684\u53c2\u6570\u6267\u884ccmd_prog\uff0c\u5e76\u5c06\u5176\u8f93\u51fa\u7684\u526f\u672c\u4fdd\u5b58\u5230logfile\u3002\u5982\u679c\u65e5\u5fd7\u6587\u4ef6\u7684\u5305 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/4014"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=4014"}],"version-history":[{"count":3,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/4014\/revisions"}],"predecessor-version":[{"id":4054,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/4014\/revisions\/4054"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=4014"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=4014"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=4014"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}-a<\/td> \u8ffd\u52a0\u4fe1\u606f\u5230\u6307\u5b9a\u7684\u65e5\u5fd7\u6587\u4ef6\u4e2d<\/td><\/tr> -s<\/td> \u663e\u793a\u65e5\u5fd7\u4fe1\u606f\uff0c\u4e0d\u5199\u5165\u5230\u6587\u4ef6\u4e2d<\/td><\/tr><\/tbody><\/table>\n\n\n\n [root@linuxcool ~]# logsave \/tmp\/logdir\/logfile bash -c \"sleep 2;date\"<\/pre>\n\n\n\n
[root@linuxcool ~]# logsave -a \/tmp\/logdir\/logfile bash -c \"sleep 2;date\"<\/pre>\n","protected":false},"excerpt":{"rendered":"