{ Berbagi, Menulis, Dan Mengajar } Ilmu… » 7. Operating System » Call External Script By Using Trigger on Mysql
Call External Script By Using Trigger on Mysql
You can use ‘\!’ instead of ‘system’. Should work in triggers and SPs.
Example:
CREATE TRIGGER tg1 BEFORE UPDATE ON alarms
FOR EACH ROW
BEGIN
\! echo “I am message from a system call.”;
END $$
—
Hello,
This is my example. It’s right!
Please, use mysql shell on linux command line (On Windows throw an syntax error):
DELIMITER $$
CREATE TRIGGER tg1 AFTER INSERT ON `your_table`
FOR EACH ROW
BEGIN
\! echo “php algun_script_php.php” >> /log/yourlog.txt
END $$
DELIMITER ;
Please, check rigth permissions for write the file yourlog.txt.
Regards!
Marco
Filed under: 7. Operating System