Execut below things
sudo apt-get update
sudo apt-get install cpulimit tc
sudo apt-get install iproute2
ifconfig -a
ip link show
ip addr show eth0
sudo apt-get update
sudo apt-get install ethtool
chmod 777 basic-poc.sh
chmod 777 cron-setup.sh
sudo ./basic-poc.sh
This repository contains a shell script that downloads a file from a specified URL at a specified rate limit and runs a script that consumes a specified percentage of CPU, memory, and network for a specified amount of time. It also schedules the script to run a specified number of times per day during specific time intervals and logs all the minute actions in a file in a specified location, with automatic file rotation. The script allows for the configuration of all relevant parameters in a single configuration file and the creation and updating of a persistent file to track changes in configuration parameters. It also supports RAM testing and multiple distributions when installing software.
- Clone the repository to your local machine:
git clone https://github.com/username/stress-testing-script.git
- Navigate to the project directory:
cd stress-testing-script
-
Edit the
config.ini
file to set your desired configuration parameters. -
Run the
master.sh
script to start the stress testing:
./master.sh
All relevant configuration parameters can be set in the config.ini
file. The parameters that can be configured include:
url
: the URL from which to download the filelimit_rate
: the rate limit for downloading the filecpu_usage
: the percentage of CPU to consume during the stress testmemory_usage
: the percentage of RAM to consume during the stress testnetwork_usage
: the percentage of network bandwidth to consume during the stress testactive_time
: the length of time for the stress test to run during each intervalinactive_time
: the length of time for the stress test to rest during each intervalruns_per_day
: the number of times to run the stress test each daylog_file
: the location and name of the log filelog_file_size_limit
: the maximum size of the log file before rotationcpu_test_interval
: the interval at which to run the CPU testnetwork_test_interval
: the interval at which to run the network test
The script also supports the creation and updating of a persistent file to track changes in configuration parameters. The persistent.ini
file is created automatically if it does not exist, and it is read and updated automatically with each run of the script.
The script is designed with modularity in mind, with separate shell scripts for each module to allow for easy maintenance and customization. The master.sh
script is the main script that calls the other scripts in the proper sequence.
The script schedules the stress test to run at the specified intervals using a cron job. The scheduler.sh
script is responsible for calculating the sleep time and updating the cron job based on changes in configuration parameters.
The script logs all the minute actions in a file in a specified location, with automatic file rotation. The logging.sh
script contains functions to log messages to a file and to check the log file size and rename it if necessary.
The script also supports RAM testing. The download.sh
script calculates the total amount of RAM on the system and adjusts the size of the memory test accordingly.
The script also supports multiple distributions when installing software. The download.sh
script checks the distribution of the system and installs the appropriate package manager and dependencies.
This project is licensed under the MIT License. See the LICENSE
file for details.