I am trying to put together a simple bash script to fire a selection of queries at a database simultaneously for load testing purposes.
So far I have a file called "input_file" that contains the following:
select sleep(10);
select sleep(11);
select sleep(12);
select sleep(13);
select sleep(14);
select sleep(15);
select sleep(16);
select sleep(17);
select sleep(18);
select sleep(19);
select sleep(20);
I then have the following code:
IFS=$'\n'
for line in $(cat input_file)
do
{
mysql -S[socket] -u[username] -p[password] -e${line}
}
done
But instead of running the queries simultaneously, it runs them one at a time, and waits for each query to finish before starting the next one. I want it to start the first query, then move on without waiting for it to finish, so that I end up with all the queries running at the same time.
I have seen various posts about people who have the opposite problem, but I can't seem to get any of their "wrong" examples to work.
&to execute themysqlin background.