Invoke a MySQL database stored procedure using a shell script and set a scheduled task

Source: Internet
Author: User

Would have been to MySQL database to create an event task to execute the stored procedure, DO data transfer ... Later, for various reasons, the crontab is used to execute periodically, calling the stored procedure.

Implementing this data transfer is divided into two steps:

The first step: Write a shell script to call the MySQL database stored procedure as follows:

#!/bin/bash
#0 1 * * * sh/home/drmtrans3/rj_proc.sh
host1=127.0.0.1
User=system
Passwd=linux
port=3306
Mysql-h${host1}-u${user}-p${passwd}-p${port}-e "Call Library name data. Process Name Pro";

This makes it possible to invoke the process of executing the library data Pro.

Step Two: Create the crontab timer task, set the script to execute at 1 o'clock in the morning/home/drmtrans3/rj_proc.sh

#vi/var/spool/cron/root

Add statement

0 1 * * * sh/home/drmtrans3/rj_proc.sh


These two steps enable you to invoke the MySQL database stored procedure using a shell script and set a scheduled task.


This article is from the "Guangzhou Linux operation and Maintenance" blog, please be sure to keep this source http://milenovo.blog.51cto.com/10554394/1692847

Invoke a MySQL database stored procedure using a shell script and set a scheduled task

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.