I have configured FTP on my Server and I want a functionality where when a csv file is uploaded in a particular folder then that csv should be imported into mysql tables.
For that I have installed incron.
My incrontab -e configuration is :
/var/ftp/test1/ IN_CREATE /usr/bin/mysql -h localhost -u root
-ppassword -e "TRUNCATE TABLE db1.test1; LOAD DATA LOCAL INFILE '$@$#' INTO TABLE db1.test1 FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\n' IGNORE 1 LINES;"
Now the issue this mysql command doesn't run on appearance of a new file though I can see an entry of it in /var/log/cron log file. When I copy the command printed in log file and try to run it, it runs perfectly.
Do anybody know what I'm doing wrong in this?
Comments
Post a Comment