Search code examples
mysqlshellstored-procedurestriggersshellexecute

How to make a shell call from within a MySQL function or Trigger


I have a table that records positions (gps) and fires insert trigger, where I check if new point is inside or outside of an area, based on the result I need to notify (send email or sms).

I am able detect from trigger that i need to send the notification but will like to be able to make a shell call or http to an url to call and send the email. something like http://myserver.com/sendemail.php?to=email@address.com&subject=New+Messaje&body=You+are+inside

If this is not posible how can be another / better approach.

Thanks


Solution

  • Database triggers are not the right place for this sort of application logic. The correct place for this logic is in your application, where you're inserting the data into the table. (Conveniently, your application is also much better situated to send mail than the database is.)