#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    2
    Rep Power
    0

    Run script trigger


    Hi,

    I want to run a shell script when a new row is added.
    i have made this trigger:

    drop trigger if exists block_action;


    delimiter ;;
    CREATE trigger block_action before insert ON data
    FOR EACH ROW
    Begin
    DECLARE result CHAR(255);
    set result = sys_exec('/usr/local/snort/script');
    END;;


    I get no error , but i get not the result that i wait from the script, i get nothing.

    So what is the problem ? did i made a mistake ?

    Thanks
    Abid
  2. #2
  3. No Profile Picture
    Problem Solver
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jan 2001
    Location
    Stockholm, Sweden
    Posts
    4,495
    Rep Power
    534
    Is the User Defined Function sys_exec() installed on the server?

    What happens if you run the function manually with something like:
    Code:
    mysql> SELECT sys_exec('touch /tmp/test_mysql');
    /Stefan
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    2
    Rep Power
    0
    Hi,

    Originally Posted by sr
    Is the User Defined Function sys_exec() installed on the server?

    What happens if you run the function manually with something like:
    Code:
    mysql> SELECT sys_exec('touch /tmp/test_mysql');
    i get this error:
    #1415 - Not allowed to return a result set from a trigger

IMN logo majestic logo threadwatch logo seochat tools logo