my python on /usr/esercizi/ is:
#!/usr/bin/python
import datetime
now = datetime.datetime.now()
aa = now.strftime("%Y-%d-%m %H:%M | %S")
out_file = open("/usr/esercizi/test.txt","w")
out_file.write("La data di oggi \n\n")
out_file.write(aa)
out_file.close()
made for test purpose I like it to be called from a TRIGGER:
mysql> CREATE TRIGGER `notifica_cambiamenti` AFTER UPDATE ON `valore`
-> FOR EACH ROW BEGIN
->
-> SET @exec_var = sys_exec(CONCAT('python /usr/esercizi/tre.py ', NEW.valore));
-> END;
-> $$
Query OK, 0 rows affected (0.06 sec)
the table has only two columns: id and valore. every time change the valore should run the tre.py
I also give:
chown mysql:mysql tre.py | and chmod 777 tre.py
the Query OK, seems to indicate that there are no syntax errors but nothing happens on the file: test.txt
What am I doing wrong?
python /usr/esercizi/tre.py 1output? What does runningmysql -e "SELECT sys_exec('python /usr/esercizi/tre.py 1');"output?mysql -h hostname -u root -ppassword -e "SELECT sys_exec('python /usr/esercizi/tre.py 1');"output?