Oracle Cloud - Prevent Idle Instances
Oracle Cloud has started shutting down and terminating Free Tier VM instances that are idle OCI Free Tier Restrictions.
The lookbusy app consumes CPU, RAM and disk IO to avoid the instances being classified as inactive.
Alternately, you can upgrade to a paid Pay As You Go (PAYG) subscription to avoid idle instances being reclaimed by Oracle.
Files
startlooking.sh- below shell scriptlookbusybinary for x86/Arm
#!/bin/bash
# Filename: /opt/oci-load/startlooking.sh
# Run this hourly via cron
# eg. @hourly nobody /opt/oci-load/startlooking.sh
# Look busy:
# - x86/Arm binaries: https://github.com/velor2012/lookbusy-docker
# - Source: https://github.com/flow2000/lookbusy
LOOKBUSY=/opt/oci-load/lookbusy
WGET=/usr/bin/wget
FLOCK=/usr/bin/flock
FLOCK_FILE=/tmp/.oci-load.flock
# Use flock to prevent multiple instances of lookbusy
# CPU: 5-15%, RAM: 2GB, Disk IO: 100M
${FLOCK} -nx "${FLOCK_FILE}" ${LOOKBUSY} -q -c 5-15 -r curve -n 1 -m 2GB -d 100MB &
# Download some random stuff, wait 1-10 mins before running wget
sleep $((1 + RANDOM % 600)) && ${WGET} -q -O /dev/null https://speed.hetzner.de/100MB.bin
sleep $((1 + RANDOM % 600)) && ${WGET} -q -O /dev/null https://speedtest.mumbai1.linode.com/100MB-mumbai.bin