As you all are aware you can create a job is MS SQL using the SQL
server Job agent and run the jobs in at any interval. Unlike MS
SQL, MySQL does not have a Job agent to schedule the jobs and
hence you need to create a CRON job in Linux or the MySQL 5.1.12
and above has been introduced with EVENT. You can write a event
to run a SP at an interval.
We will see how to write a CRON job to run a Stored Procedure at
an Interval. Follow the steps below
At the Prompt> CRON –e
0,5,10,15,20,25,30,35,40,45,50,55 * * * *
/root/Call_SP.sh 2>&1 >> /root/call_sp.log
Here I’m specifying an interval of 5 mins, hence the cron job
will run the sp every 5 mins
Now create a shell script to call the sp from a database.
At the Prompt> vi Call_SP.sh
mysql -h ‘IPADDRESS’ -u root –p’password’ mydatabase -e
"call …
[Read more]