Hi guys,

Trying to set up a cron job using this tutorial

I have replaced {my/magento/install} with my site path and tried to execute it as a unix command.

/usr/bin cd /{/var/sites/e/mysite.com}/shell/; php -f attributeimport.php -- --attribute manufacturer --file ../manufacturers.txt;

It gives me an error:
Error: The command you entered does not appear to be valid or the program does not exist. If it is a script, please create it before setting up the cron job.

Recommended Answers

All 2 Replies

You can remove /usr/bin. When not sure about the path of a command you can use env, e.g.:

/usr/bin/env php script.php --attribute hello --import ../world.txt

but not in case of cd, you don't need it.

In any case I'm not sure the above script will work, because the --file attribute is the equivalent of the -f flag, used by the PHP CLI SAPI to define a script or a file to execute, from man php:

--file file
-f file        Parse and execute file

I see that in your tutorial this is used to define a file to import in the script. If you see you cannot get it to work, then change the attribute to something else, like --import and then in the code just replace:

$this->getArg('file')

with:

$this->getArg('import')

then it should work fine.

Thanks Cereal,

That's sorted now!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.