I have a php script I'm trying to run using a cron job. I can execute the script from CLI doing
/usr/local/bin/php Import_Product_Data.php
So I have tried..
0 0 * * * /usr/local/bin/php Import_Product_Data.php
and
crontab 0 0 * * * /usr/local/bin/php Import_Product_Data.php
and
crontab -e 0 0 * * * /usr/local/bin/php Import_Product_Data.php
Vince V. says to open your cronfile and do it.. When I enter crontab -e
, I get
*/5 * * * * /root/autosvnup.sh
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"/tmp/crontab.ZBGTFu" 1L, 31C
Then I get stuck and not sure what to do.. Would someone help me out?
That's the
vi
editor, your default text editor (checkman vi
). Here are the commands to edit your crontab withvi
:What you're seeing is the vim text editor. When you do
crontab -e
it opens up your crontab in the default editor. The default editor can be changed by, for example:..some find nano a lot easier to work with as vim has a somewhat steep learning curve.
To add your script to the crontab, just insert it on a new line, so that your crontab looks like this:
Then save+exit, and it should run once every midnight (as per the
0 0 * * *
)