Command is executed from terminal but not in the crontab

Hi guys,

Finally, I found a way to run the exports of products in .csv or .txt file from terminal (Previously I was able only via URL) with the following command:
REQUEST_URI=‘Process/Cron.php’ SCRIPT_NAME=‘Process/Cron.php’ php-cgi -f Process/Cron.php run=1 engine=ExportProducts service=1 id=90 export_file=testcron_export.csv

And the products are exported successfully.

But, when I am setting up this command in the crontab, it’s not executed.

I tried using different ways, also tried to copy the command in bash script and set-up the bash script in the crontab but without success.
These are all the combinations that I’ve tried in the crontab:

*/2 * * * * REQUEST_URI=‘Process/Cron.php’ SCRIPT_NAME=‘Process/Cron.php’ php-cgi -f Process/Cron.php run=1 engine=ExportProducts service=1 id=90 export_file=testcron_export.csv
*/2 * * * * ./testcron2.sh
*/2 * * * * ~/www.site_name.com/testcron2.sh
*/2 * * * * sh /home/site_name/SspStore/testcron2.sh
*/2 * * * * sh testcron2.sh
*/2 * * * * /bin/sh testcron2.sh
*/2 * * * * /bin/sh /home/site_name/SspStore/testcron2.sh
*/2 * * * * php-cgi -f REQUEST_URI=‘Process/CoreCron.php’ SCRIPT_NAME=‘Process/Cron.php’ Process/Cron.php run=1 engine=ExportProducts service=1 id=90 export_file=testcron_export.csv
*/2 * * * * usr/bin/sh testcron2.sh
*/2 * * * * usr/bin/sh /home/site_name-stage/SspStore/testcron2.sh

Any help or suggestion?

Thank you very much in advance

Hi,

create a bash file put everything in there. Write a logfile like this:

*/2 * * * * /full/path/to/your/script.sh > /writable/location/for/logfiles/log.txt 2>&1

Let the script run as user. php-cgi is called by the webserver, use php-cli

Regards,
Johannes