Skip to content

防止甲骨文被回收

bash
apt -y update

apt -y install curl build-essential

curl -L http://www.devin.com/lookbusy/download/lookbusy-1.4.tar.gz -o lookbusy-1.4.tar.gz

tar -xzvf lookbusy-1.4.tar.gz

cd lookbusy-1.4/

./configure && make && make install
  1. 新建systemd服务
    bash
    systemctl edit --full --force lookbusy.service
  2. 写入如下配置:格式一定要和下面的一样,包括换行,不要有多余的空格等,等会肯定启动出错
    bash
    [Unit]
    Description=lookbusy service
     
    [Service]
    Type=simple
    ExecStart=/usr/local/bin/lookbusy -c 20 -m 5120MB
    Restart=always
    RestartSec=10
    KillSignal=SIGINT
     
    [Install]
    WantedBy=multi-user.target
  3. 参数 -c指cpu使用率,-m指内存使用率。 可以根据自己的实例配置来适当配置。
    1. 启动并保存
      bash
      systemctl enable --now lookbusy.service
    2. 如果要停止
      bash
      systemctl disable --now lookbusy.service
    3. 检查机器cpu、内存、负载情况,确定超过甲骨文规定的10%即可:
      bash
      top