calling perl script from mysql trigger
Posted
by
Bahareh
on Server Fault
See other posts from Server Fault
or by Bahareh
Published on 2012-09-10T08:43:57Z
Indexed on
2012/09/10
9:39 UTC
Read the original article
Hit count: 365
I want to call a perl script inside a mysql after insert trigger. but my trigger does not work.I find this solution from google. here is my code:
DROP TRIGGER IF EXISTS 'tr1'//
CREATE TRIGGER 'tr1' AFTER INSERT ON 'username'
FOR EACH ROW begin
SET @result=sys_exec(CONCAT('/usr/bin/perl /etc/p1.pl'));
end
//
and my p1.pl code:
#!/usr/bin/perl
open(MYFILE,'>>/etc/data.txt');
print MYFILE "BOB\n";
close MYFILE;
thanks.
© Server Fault or respective owner