Linux shell script that updates one value in MYSQL table and schedule with crontab
$10-30 USD
In Progress
Posted almost 10 years ago
$10-30 USD
Paid on delivery
I want to simulate User growth on my website
So I need a cron job on my linux webserver that executes a shell script that retrieves a value from my local mysql table, adds a number to it and writes it back. The cron should run all 5 minutes.
For adding the number, there should be a function with the following parameters:
1. probability that number should be added (like tossing a coin).
if prob = 1, number will be added 100% sure
if prob = 0, nothing happens, no number will be added
if prob = 0.5, number will be added with a 50% probability. Means, assuming the script runs every 5 minutes, number would be added roughly every second run of the cron.
etc. etc.
2. size of number: should be random number. Range should be defined by upper and lower bound.
----EXAMPLE---
var_prob = 0.5;
var_upper = 50;
var_lower = 10;
function determine_if_number_should_be_added(prob) as boolean {
out = calculate(prob);
}
if (determine_if_number_should_be_added(prob) == TRUE) {
number_to_add = generate_random_number(var_lower, var_upper);
old = mysql(retrieve value)
new = old +number_to_add;
mysql(UPDATE...);
}
WHAT TO DELIVER?
-----------------
1. provide shell script for review
2. provide written tutorial how to install it on linux server
3. login into my server via ssh and install the script (shell and crontab)and make it run