0

I want to create a trigger so that when a field is updated it kicks off a local bash script (or python...whatever) to kick off a workflow (emails, work requests, etc). Is it possible to execute local system scripts/executables from mysql SQL? My google searches have been unsuccessful.

1

2 Answers 2

0

It seems not easy to do it. I think it will be better to do it at the application level if at all possible. You can also query your table for updated rows every x minutes and then execute the script in a cron job.

2
  • To recognize the updated rows easily, you can add a new column updated that should be set to 1 to indicate the updated rows. A trigger after update will set this flag to 1 and your script will clear it.
    – Khaled
    Feb 27, 2012 at 15:44
  • Just default the column to 1 instead of abusing a trigger for this.
    – adaptr
    Feb 27, 2012 at 16:22
0

As already suggested, a once-per-minute cron job that queries a table with pending tasks is the better solution here.

You won't be calling potentially privileged OS code from a database server, and the control over task execution remains firmly in the hands of your application(s).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .