non-production MySQL query/UDF that triggers a bash command

694 Views Asked by At

How can I make a MySQL query/script that will trigger a bash command and finish when it's done?

here is what I thought of:

  1. make a bash daemon that will monitor a MySql table and execute command uppon change
  2. use the bash script to update the table on finish and the MySQL script that modified the table sleep/loop until it happens

Is this possible? or is there a better way?
I want to make this sql script so I can incorporate it in a Navicat MySQL-MSSQL Batch job


update:
this is not a production or public server, I use it just for data filtering, so if I can introduce a UDF or alter the server to execute shell commands it's ok, as long as it can be triggered using the remote CLI.

1

There are 1 best solutions below

3
On

You can execute shell commands with your mysql script with ! shell command. Or you can create a shell script that have mysql commands. Either could work for you.