防止oracle免费vps回收

最近收到oracle的邮件, 空闲的机器可能被回收:

Oracle Cloud Infrastructure Compute – Resource Maintenance Reminder

Oracle新政策

Reclamation of Idle Compute Instances

Idle Always Free compute instances may be reclaimed by Oracle. Oracle will deem virtual machine and bare metal compute instances as idle if, during a 7-day period, the following are true:

  • CPU utilization for the 95th percentile is less than 10%
  • Network utilization is less than 10%
  • Memory utilization is less than 10% (applies to A1 shapes only)

下载lookbusy并编译

sudo 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
sudo make install

创建systemd服务

systemctl edit --full --force lookbusy.service

输入以下配置

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

参数-c指cpu使用百分比,-m指内存使用量。

启动并设置lookbusy开机自启:

sudo systemctl enable --now lookbusy.service

Related Posts

Leave a Reply

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