网友 zc_cz 说:
应该是最简的,只依赖******d(当然,还依赖cg**up),只产生一个******* unit文件。默认一直跑,可以用c**n任务定时启停这个*******。
不过只考虑给CPU和内存加压,**方面基*上必定要依赖其他组件了。比如自己装个speed****,弄个c**n任务定时跑一跑。
- memt_size=$(free -m|awk ‘/^Mem/{p**nt int($2/4)}’);
- free_size=$(free -m|awk ‘/^Mem/{p**nt int($4/2)}’);
- ((mem_size>free_size)) && block_size=${free_size} || block_size=${memt_size}
- [[ &*uot;$(uname -m)&*uot; == &*uot;aarch**&*uot; ]] || block_size=1;
- cpu*=$(lscpu | awk ‘/^CPU\(/{p**nt $NF*100/4}’);
- echo &*uot;[Unit]
- Desc**ption=stange oracle cloud free tier instance keepalive
- [Service]
- Type=******
- Exe**tartPre=/usr/bin/dd if=/dev/ze** of=/dev/shm/mem.img bs=1M count=${block_size}
- Exe**tart=/usr/bin/dd if=/dev/ze** of=/dev/null
- Exe**topPost=/bin/rm -f /dev/shm/mem.img
- CPU*uota=${cpu*}%
- [Install]
- WantedBy=multi-user.target&*uot; > /lib/******d/******/cp**.*******
- ******ctl daemon-reload;
- ******ctl enable cp** –now;
- ******ctl restart cp**;
未经允许不得转载:爱主机 » [经验]
水一帖甲骨文保活