{"id":538492,"date":"2021-09-24T00:51:19","date_gmt":"2021-09-23T16:51:19","guid":{"rendered":"http:\/\/4563.org\/?p=538492"},"modified":"2021-09-24T00:51:19","modified_gmt":"2021-09-23T16:51:19","slug":"%e7%8c%ab%e6%b1%a0%e6%8c%96%e7%9f%bf%e6%80%8e%e4%b9%88%e9%99%90%e5%88%b6cpu","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=538492","title":{"rendered":"\u732b\u6c60\u6316\u77ff\u600e\u4e48\u9650\u5236cpu?"},"content":{"rendered":"\n<p>  \t\t\t\t\t<strong>\u6211\u662f\u574f\u866b<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2021-8-26 14:47:04\t<\/p>\n<h3>\u732b\u6c60\u6316\u77ff\u600e\u4e48\u9650\u5236cpu?<\/h3>\n<p>  \t\t\u6c42\u5e26\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>gcp<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2021-8-26 14:56:36\t<\/p>\n<h3><\/h3>\n<p>  \t\t \u672c\u5e16\u6700\u540e\u7531 gcp \u4e8e 2021-8-26 14:58 \u7f16\u8f91 <\/p>\n<p> \u5b98\u7f51\u7684\u4e00\u952e\u811a\u672c \u5c31\u63d0\u793a\u4e86 \u600e\u4e48\u9650\u5236cpu<\/p>\n<p>  https:\/\/github.com\/C3Pool\/xmrig_setup\/blob\/master\/setup_c3pool_miner.sh#L374\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u6211\u662f\u574f\u866b<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2021-8-26 14:55:38\t<\/p>\n<h3><\/h3>\n<p>  \t\t:'(:'(:'(:'(https:\/\/cdn.jsdelivr.net\/gh\/master-of-forums\/master-of-forums\/public\/images\/patch.gif\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>liuming<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2021-8-26 14:57:28\t<\/p>\n<h3><\/h3>\n<p>  \t\t\u76f4\u63a5\u5f00\u6ee1cpu\u5c31\u884c\uff0c\u9650\u5236\u5e72\u5565\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>guesser<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2021-8-26 14:58:22\t<\/p>\n<h3><\/h3>\n<p>  \t\tcpuLimite\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u6211\u662f\u574f\u866b<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2021-8-26 14:59:47\t<\/p>\n<h3><\/h3>\n<p>  \t\tliuming \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2021-8-26 14:57<br \/>  \u76f4\u63a5\u5f00\u6ee1cpu\u5c31\u884c\uff0c\u9650\u5236\u5e72\u5565<\/p>\n<p> yc002t94\u8fd8\u8981\u91c7\u96c6https:\/\/cdn.jsdelivr.net\/gh\/master-of-forums\/master-of-forums\/public\/images\/patch.gif\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>liuming<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2021-8-26 15:00:54\t<\/p>\n<h3><\/h3>\n<p>  \t\t\u6211\u662f\u574f\u866b \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2021-8-26 14:59<br \/>  94\u8fd8\u8981\u91c7\u96c6<\/p>\n<p> :lol\u6211\u65e9\u5c31\u5173\u673a\u4fdd\u5e73\u5b89\u4e86\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u6211\u662f\u574f\u866b<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2021-8-26 15:09:43\t<\/p>\n<h3><\/h3>\n<p>  \t\tliuming \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2021-8-26 15:00<br \/>  \u6211\u65e9\u5c31\u5173\u673a\u4fdd\u5e73\u5b89\u4e86<\/p>\n<p> yc007t\u4f60\u4e5f\u5728\u6296\u97f3\u5237\u5230\u7b14\u8da3\u9601\u4e86|?https:\/\/cdn.jsdelivr.net\/gh\/master-of-forums\/master-of-forums\/public\/images\/patch.gif\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u6302\u673a\u5b9d<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2021-8-26 15:21:08\t<\/p>\n<h3><\/h3>\n<p>  \t\t \u672c\u5e16\u6700\u540e\u7531 \u6302\u673a\u5b9d \u4e8e 2021-8-26 15:27 \u7f16\u8f91 <\/p>\n<p> https:\/\/cdn.pic.wtf\/2021\/08\/26\/3ce1b5f50cfdc.png<\/p>\n<p>  \u4e00\uff1a\u5b89\u88c5yum install cpulimit<\/p>\n<p>  \u811a\u672c\uff1a<br \/>  #!\/bin\/bash<br \/>  # auth:kaliarch<br \/>  # func:sys info check<br \/>  # version:v1.0<br \/>  # sys:centos6.x\/7.x<\/p>\n<p>  set -e<br \/>  [ $(id -u) -gt 0 ] &amp;&amp; exit 1<\/p>\n<p>  # cpu\u4f7f\u7528\u8d85\u8fc7\u767e\u5206\u4e4b\u591a\u5c11\u8fdb\u884c\u9650\u5236<br \/>  PEC_CPU=80<\/p>\n<p>  # \u9650\u5236\u8fdb\u7a0b\u4f7f\u7528\u767e\u5206\u4e4b\u591a\u5c11,\u5982\u679c\u7a0b\u5e8f\u4e3a\u591a\u7ebf\u7a0b\uff0c\u5355\u4e2acpu\u9650\u5236\u4e3a85\uff0c\u5982\u679c\u4e3a\u591a\u6838\u5fc3\uff0c\u5c31\u9700\u8981\u6309\u7167\u6bd4\u4f8b\u5199\uff0c\u4f8b\u5982cpu\u4e3a2c\uff0c\u50cf\u9650\u5236\u591a\u7ebf\u7a0b\u5360\u6bd480%\uff0c\u5c31\u5199170<br \/>  LIMIT_CPU=1900<br \/>  # \u65e5\u5fd7<br \/>  LOG_DIR=\/var\/log\/cpulimit\/<\/p>\n<p>  # \u8d85\u8fc7\u9600\u503c\u8fdb\u7a0bpid<br \/>  PIDARG=$(ps -aux |awk -v CPU=${PEC_CPU} &#8216;{if($3 &gt; CPU) print $2}&#8217;)<br \/>  CPULIMITCMD=$(which cpulimit)<\/p>\n<p>  install_cpulimit() {<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;[ ! -d \/tmp ] &amp;&amp; mkdir \/tmp || cd \/tmp<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;wget -c https:\/\/github.com\/opsengine\/cpulimit\/archive\/v0.2.tar.gz<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;tar -zxf v0.2.tar.gz<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;cd cpulimit-0.2 &amp;&amp; make<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;[ $? -eq 0 ] &amp;&amp; cp src\/cpulimit \/usr\/bin\/<br \/>  }<\/p>\n<p>  do_cpulimit() {<br \/>  [ ! -d ${LOG_DIR} ] &amp;&amp; mkdir -p ${LOG_DIR}<br \/>  for i in ${PIDARG};<br \/>  do<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;MSG=$(ps -aux |awk -v pid=$i &#8216;{if($2 == pid) print $0}&#8217;)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;echo ${MSG}<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;[ ! -d \/tmp ] &amp;&amp; mkdir \/tmp || cd \/tmp<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;nohup ${CPULIMITCMD} -p $i -l ${LIMIT_CPU} &amp;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;echo &quot;$(date) &#8212; ${MSG}&quot; &gt;&gt; ${LOG_DIR}$(date +%F).log<br \/>  done<br \/>  }<\/p>\n<p>  main() {<\/p>\n<p>  &nbsp; &nbsp;&nbsp; &nbsp;hash cpulimit<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;if [ $? -eq 0 ];then<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; do_cpulimit<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;else<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; install_cpulimit &amp;&amp; do_cpulimit<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;fi<br \/>  }<\/p>\n<p>  main  \t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u6211\u662f\u574f\u866b<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2021-8-26 15:27:44\t<\/p>\n<h3><\/h3>\n<p>  \t\t\u6302\u673a\u5b9d \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2021-8-26 15:21<br \/>  \u4e00\uff1a\u5b89\u88c5yum install cpulimit<\/p>\n<p>  \u811a\u672c\uff1a<\/p>\n<p> \u5927\u4f6chttps:\/\/cdn.jsdelivr.net\/gh\/master-of-forums\/master-of-forums\/public\/images\/patch.gif\t\t\t  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6211\u662f\u574f\u866b \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2021&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/538492"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=538492"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/538492\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=538492"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=538492"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=538492"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}