Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2011
    Posts
    3

    Unanswered: Call Shell Function from mysql

    Hi all,
    I am trying a scenario for calling a shell script when ever a trigger is called. Can some one guide me how to achive this scenario. Also it should passes the value from the table to the shell script. Can some one explain me along with the example.

    Thanks in Advance,
    Santhosh V Kumar.

  2. #2
    Join Date
    Jun 2007
    Location
    London
    Posts
    2,527
    Quote Originally Posted by santhoshvkumar View Post
    I am trying a scenario for calling a shell script when ever a trigger is called. Can some one guide me how to achive this scenario.
    I'm pretty sure you can't do this but, even if you could, it would kill performance.

    Normal approach would be to write data to a table with a timestamp then the shell script would look for data in the table that had arrived after it last ran. Improvements to this might include:
    • Not updating the time if there's any errors.
    • The time it last ran can be stored as a heartbeat which also shows you the process is running.
    • Sending an email to a support group if there's any errors.
    • Having a maximum amount of data it can process at any one go to avoid locking etc.
    • Altering how often it polls the table depending on how much data it finds.
    • Removing the triggers and then accessing the data direct.

  3. #3
    Join Date
    Apr 2011
    Posts
    3

    can you tell me some example

    Can.. you please tell me some simple example. I am checking for past one week.

  4. #4
    Join Date
    Jun 2007
    Location
    London
    Posts
    2,527
    Quote Originally Posted by santhoshvkumar View Post
    Can.. you please tell me some simple example. I am checking for past one week.
    What have you managed to create in past week and we'll go from there.

  5. #5
    Join Date
    Apr 2011
    Posts
    3

    Setup Database

    Hi,
    I actually got an database which consist of 3 column the things it will get the data from a web application and I need to read the column that last affected in the database. and I need to read it through a shell or any program and need to store it in a file system. inorder for some other computation. I developed a code with shell script to do this process. Also I called with mysql >! someshell.sh its working fine. but when ever there is a update in table how to achive it. Please help me with this.

    With Regards,
    Santhoshvkumar

  6. #6
    Join Date
    Jun 2007
    Location
    London
    Posts
    2,527
    Just update a timestamp each time you insert or update a record.

    Then in your shell script select any data from the table that has a timestamp older than the last time you pulled data from the table.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •