Hello,
I am having a CSV daily sent via ftp to my public_html folder on a website. I am trying to make a cron job to import it into database called "grijanjetuzla_stanjeracuna" in table "saldo" , and delete records in table "saldo" it next day so I can import it again with fresh data.
This is what I have so far:
mysql --host localhost --user grijanjetuzla_saldouser --password="PASSWORD" -D stanjeracuna -e "TRUNCATE TABLE saldo;" ;
mysql --host localhost --user grijanjetuzla_saldouser --password="PASSWORD" -D grijanjetuzla_stanjeracuna -e "LOAD DATA LOCAL INFILE "/home4/username/public_html/Saldo.csv" IGNORE INTO TABLE saldo COLUMNS ENCLOSED BY '"' TERMINATED BY ',' LINES TERMINATED BY '\r\n';";
Error I got is this:
/bin/sh: -c: line 0: unexpected EOF while looking for matching `''
/bin/sh: -c: line 1: syntax error: unexpected end of file
Does anybody know how to import it, I've spent days on this issue.
It does import thru phpmyadmin but not thru cron job.
Thanks
I am having a CSV daily sent via ftp to my public_html folder on a website. I am trying to make a cron job to import it into database called "grijanjetuzla_stanjeracuna" in table "saldo" , and delete records in table "saldo" it next day so I can import it again with fresh data.
This is what I have so far:
mysql --host localhost --user grijanjetuzla_saldouser --password="PASSWORD" -D stanjeracuna -e "TRUNCATE TABLE saldo;" ;
mysql --host localhost --user grijanjetuzla_saldouser --password="PASSWORD" -D grijanjetuzla_stanjeracuna -e "LOAD DATA LOCAL INFILE "/home4/username/public_html/Saldo.csv" IGNORE INTO TABLE saldo COLUMNS ENCLOSED BY '"' TERMINATED BY ',' LINES TERMINATED BY '\r\n';";
Error I got is this:
/bin/sh: -c: line 0: unexpected EOF while looking for matching `''
/bin/sh: -c: line 1: syntax error: unexpected end of file
Does anybody know how to import it, I've spent days on this issue.
It does import thru phpmyadmin but not thru cron job.
Thanks
Last edited by a moderator: