#!/bin/bash

function cleanup()
{
	kill $(jobs -p)
}

trap cleanup INT

(
	while true
	do
		for i in {500..502}
		do
			echo "insert into account set account_id = $i, name = 'test';"
		done

		for i in {502..500}
		do
			echo "delete from account where account_id = $i;"
		done
	done
) | mysql -f -u test test &

(
	while true
	do
		for i in {500..502}
		do
			echo "insert into counter set account_id = $i, counter_id = $i;"
		done
	done
) | mysql -f -u test test &

wait
