Oracle officials are now reclaiming idle instance resources, and free instances with low utilization may be cleaned up. If the following conditions are met within seven days, Oracle will consider the free instance as idle and reclaim it.
-
CPU utilization below 10% for 95% of the time
-
Network utilization below 10%
-
Memory utilization below 10% (only applicable to A1 shape) (ARM instances)
Official announcement link: https://docs.oracle.com/en-us/iaas/Content/FreeTier/freetier_topic-Always_Free_Resources.htm
Oracle Cloud will clean up idle instance resources. Many users use Oracle free VPS to build websites or set up proxies, SSR/V2Ray airports. It would be a pity if they were deleted. How to keep Oracle Cloud free VPS servers alive? Here are some tutorials on how to keep Oracle free instances alive. Feel free to try if needed.
Keep CPU Active by Calculating Pi#
nohup echo "scale=99999999;4*a(1)" | bc -lq > /dev/null &
nohup cpulimit -l 30 -p 22489 >/dev/null &
The 'scale' represents the number of decimal places, and the larger the number, the longer the calculation time.
The 'l' controls the CPU usage from 0 to 200.
The 'p' is the PID of the program, which can be found through the 'top' command or 'ps -aux | grep bc'.
After running the above commands, execute the 'exit' command and then close the window to exit Xshell. The background commands will not terminate.
Alternatively, use a shell loop:
nohup cpulimit -l 30 bash -c "while :;do a=1;done" > /dev/null 2>&1 &
If an error occurs, install 'bc':
apt install bc -y && apt install cpulimit -y
Source: https://hostloc.com/thread-1131769-1-1.html
One-Click Keep-Alive Script for Oracle Cloud (Option 1)#
NeverIdle project link: https://github.com/layou233/NeverIdle
# Install wget and screen on the server
yum install -y wget screen
# Download the compiled executable file
# For AMD servers
wget https://github.com/layou233/NeverIdle/releases/download/0.1/NeverIdle-linux-amd64 -O NeverIdle
# For ARM
wget https://github.com/layou233/NeverIdle/releases/download/0.1/NeverIdle-linux-arm64 -O NeverIdle
# Change file permissions
chmod 777 NeverIdle
# Run the program using screen
screen -R baohuo
# Start the program
./NeverIdle -c 2h -m 2 -n 4h
# Detach from the screen by pressing Ctrl+A+D
# Reattach to the screen
screen -R baohuo
Command parameters:
./NeverIdle -c 2h -m 2 -n 4h
Where:
-
-c
enables periodic CPU waste, followed by the interval time for each waste. For example, waste once every 12 hours, 23 minutes, and 34 seconds would be12h23m34s
. Fill in according to the format. -
-m
enables memory waste, followed by a number representing the amount of memory in GiB. After starting, it will occupy the corresponding amount of memory and will not release it until the process is manually killed. -
-n
enables periodic network waste, followed by the interval time for each waste. The format is the same as CPU. It will periodically perform an Ookla Speed Test (and output the result!).
One-Click Keep-Alive Script for Oracle Cloud (Option 2)#
Project link: Oracle One-Click Automatic Exercise
Starting from 0:00 every day, the CPU will automatically exercise for 600 seconds every 3 hours, totaling 80 minutes of exercise per day (load 10%~20%). It meets the requirement of CPU utilization exceeding 10% for 5% of the time (at least 72 minutes per day). The exercise amount can be adjusted according to your own situation.
If you have Baota, you can also use the panel's built-in scheduled tasks. The one-click keep-alive code for Oracle is as follows:
# For AMD version
cd /root && wget https://raw.githubusercontent.com/velor2012/lookbusy-docker/main/lookbusy -O lookbusy && chmod +x lookbusy && sudo echo "0 */3 * * * root timeout 600 /root/lookbusy -c 10-20 -r curve" >> /etc/crontab && grep -q centos /etc/os-release && service crond restart || service cron restart
# For ARM version
cd /root && wget https://raw.githubusercontent.com/velor2012/lookbusy-docker/main/lookbusy-arm -O lookbusy && chmod +x lookbusy && sudo echo "0 */3 * * * root timeout 600 /root/lookbusy -c 10-20 -r curve" >> /etc/crontab && grep -q centos /etc/os-release && service crond restart || service cron restart
View execution logs:
cat /var/log/cron | grep lookbusy
One-click uninstallation:
sed -i "/lookbusy/d" /etc/crontab && rm -f /root/lookbusy && grep -q centos /etc/os-release && service crond restart || service cron restart
One-Click Keep-Alive Script for Oracle Cloud (Option 3)#
Oracle-server-keep-alive-script project link: Oracle-server-keep-alive-script
All resources are dynamically occupied and adjusted in real-time to avoid occupying resources when other resources have already exceeded the limit.
Compatible systems: Currently verified to work on Ubuntu, should work on other mainstream systems as well.
Optional occupation: CPU, memory, bandwidth
After installation, wait for 5 minutes to check the occupation status (the initial pressure parameter for CPU occupation is low, so it may not show the load if the time is not enough). If there is no occupation for more than 10 minutes, there may be a problem. Please uninstall the script and provide feedback.
Due to delayed updates, please wait for the CDN to load the latest script. Please note the current script update date: 2023.02.04
Option 1 is for installation, option 2 is for uninstallation, and option 3 is for exiting the script. During the installation process, pressing Enter blindly will occupy all optional resources. If you don't want to occupy anything, input 'n' and then press Enter.
It will ask if you want to customize the parameters for bandwidth occupation. The default option is 'n', which uses the default configuration when you press Enter. If you input 'y' and then press Enter, you need to customize the parameters as prompted.
curl -L https://raw.githubusercontent.com/spiritLHLS/Oracle-server-keep-alive-script/main/oalive.sh -o oalive.sh && chmod +x oalive.sh && bash oalive.sh
Or
bash oalive.sh
Or
bash <(wget -qO- --no-check-certificate https://raw.githubusercontent.com/spiritLHLS/Oracle-server-keep-alive-script/main/oalive.sh)
Script description:
-
CPU occupation has two modes: calculating prime numbers and scientific calculations. The occupation range is set to 15%~25%.
-
CPU occupation is dynamic, checking every few seconds and dynamically adjusting the calculation task and interval.
-
CPU occupation has double insurance. It not only adjusts dynamically but also sets the highest occupation in the daemon process. The default is 30% (number of cores * 13% if it is lower than 30%).
-
Memory occupation is set to occupy 20% of the total memory, with 300 seconds of occupation and 300 seconds of rest.
-
Memory occupation checks every 300 seconds and dynamically adjusts the occupation size. If your memory is greater than 20%, it will not increase the occupation.
-
Bandwidth occupation downloads a file of 1G~10G size every 45 minutes for occupation. It only downloads without saving, and the download process does not occupy the hard disk.
-
Bandwidth occupation dynamically adjusts the actual download bandwidth/rate. The maximum download duration is 10 minutes. Before each download, it tests the maximum available bandwidth and adjusts it to 20% bandwidth download in real-time.
-
During the occupation, it uses daemon processes and startup services to ensure continuous and effective occupation tasks.
-
You can choose to uninstall all occupation services with one click. Uninstalling will remove all scripts and services, including tasks, daemon processes, and startup settings.
Waste resources periodically, suitable for Oracle keep-alive. This script is made to cope with Oracle's latest recovery mechanism.