编译并安装lookbusy

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

新建systemd服务:

systemctl edit --full --force lookbusy.service

写入如下配置:

[Unit]
Description=lookbusy service

[Service]
Type=simple
ExecStart=/usr/local/bin/lookbusy -c 11 -m 2000MB
Restart=always
RestartSec=10
KillSignal=SIGINT

[Install]
WantedBy=multi-user.target

参数-c指cpu使用率,-m指内存使用量。可以根据自己的实例配置来适当配置。

启动并保存

systemctl enable --now lookbusy.service

如何停止

systemctl disable --now lookbusy.service

检查机器cpu、内存、负载情况

Top

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *