Copy codeThe Code is as follows :#! /Bin/bash
#********************************#
# Run fun in the concurrent background #
# For wanggy 2012-01-25 #
# Note :#
# Fun_num number of times the fun function runs in the background #
# SQL _num SQL run times of each function #
#********************************#
# Database variable settings
Dbhost = 192.168.1.182
Dbbase = recharge
Dbuser = infosms
Dbpass = infosms
Fun ()
{
# Number of function concurrency
Fun_num = 5
# Number of SQL executions in the function
SQL _num = 1000
For (j = 1; j <= $ fun_num; j ++); do
{
Random_num = 'echo $ RANDOM'
Echo "$ j functions"
For (I = 1; I <= $ call_num; I ++); do
Mysql-h $ dbhost-u $ dbuser-p $ dbpass-D $ dbbase <GETRECODE> fun _ $ j. log
CALL fun_accountbycustid (2, 0, 10. $ random_num)
GETRECODE
Echo "number $ j function number $ I"
Echo "$ j functions $ I"> call. log
Done
Echo "the $ j function execution is completed ......"
}&
Done
Wait
}
Main ()
{
Fun
}
Main
Exit 0