cron job set up in magento on server - php

I worked on magento and I want to run cron job on the server.
If I run domainname/magentofolder/cron.php in the address bar it works.
But when I try to set up cron job on cpanel it will not working.

If executing the php cron file doesn't work you can also try so set up the cron to use the cron.sh file like this:
*/5 * * * * /bin/sh /absolute/path/to/magento/cron.sh

Try this
*/5 * * * * wget -O /dev/null -q http://www.YOURDOMAIN.com/PATH_TO_MAGENTO/cron.php > /dev/null
more information is on xtento

Related

Why my crontab not working using wget command?

When i run my url https://localhost/panel/index.php?m=user_games&p=check_expire by using chrome the code is run and shutting down the server when expier.
But when i need to run this as a crontab using this command:
* * * * * * wget -q --spider "https://localhost/panel/index.php?m=user_games&p=check_expire"
nothing happend, why?
Seem the crontab not run, because you define wrong crontab command. You put six *, as I know we just need five *. Please try like this
* * * * * wget -q --spider "https://localhost/panel/index.php?m=user_games&p=check_expire"
To make sure your crontab run, please create log when wget executed.

Cronjob can't run php perfectly

I have good .php file when run directly via address bar browser.
But not process perfectly when run via cron job, may be it's just process first query msyql/first loop.
there is any special configuration for it?
My cron setup is
0 * * * * wget --spider -O - http://domain.com/cronjob >/dev/null 2>&1
See below example that is run your file on per minute
* * * * * /usr/bin/php /var/www/html/<your-file-name>
< and > are removed in <your-file-name>

Cronjob not executing php?

I want to run a .php every 10 min with a cron job on Ubuntu.
This is my crontab:
*/10 * * * * php -f /var/www/html/gapi/src/test2.php >/dev/null 2>&1
And this is in the log file:
CRON[9994]: (root) CMD (php -f /var/www/html/gapi/src/test2.php >/dev/null 2>&1)
In this php is an api call, and I can see the api calls live at the dashboard of the api provider, so I know the php is not running every 10 mins.
I set the file permission to 755, what else can I do to make it work?
Updated Crontab:
*/10 * * * * php -f /var/www/html/gapi/src/test2.php
Try requesting the file through your web server rather than calling the script via the command line PHP interpreter.
*/10 * * * * wget -q -O /dev/null http://localhost/gapi/src/test2.php
(-q to suppress output, -O /dev/null to redirect file output so it doesn't save it)
or using curl instead:
*/10 * * * * curl --silent http://localhost/gapi/src/test2.php
The URL will depend on how your server is set up - you say it works through your browser at the moment so just use the same URL in the cron file.

Cron job with CodeIgniter using wget

I am pretty new to setting up cron jobs. What I've done so far is set one up to run every 5 minutes using the following script:
*/5 * * * * wget -q localhost:8888/example/index.php/controller/function
When I run just the wget part from the command line, it works perfectly. But in the crontab, while the logs show it being ran every 5 minutes, nothing is happening. Am I missing something easy? Any help is appreciated!
Thanks!
You can force a particular shell with
SHELL=bash
*/5 * etc...
or whatever in the crontab. Then make sure wget is available in that shell's path.
Otherwise just give an absolute /usr/bin/wget path instead.
*/5 * * * * /usr/bin/wget etc...

cronjob is not working Linux

I want a script file to run once every minute.. I've written this command.
* * * * * php -q /home/<username>/public_html/cron.php
But, this cronjob is not working. whenever, I try to open this file cron.php in browser, it works fine.
I'm using Linux OS. Is there a way to debug it in order to come to know the error?
If you're using Ubuntu as I am, use the full path.
* * * * * /usr/bin/php -q /home/<username>/public_html/cron.php
Have you added an empty line (new line) after your cronjob?
To debug:
Append 2>&1 to the end of your Crontab command. This will redirect the stderr output to the stdout. Then ensure you're logging the crontab's Unix command.
* * * * * php -q /home/<username>/public_html/cron.php; ls -la >>/var/log/cronrun 2>&1
This will capture anything from the Unix command.
A couple of additional hints: Write out the environment variables by issuing the command set with no parameters. And get the shell to echo each command with the set -x command. At the top of your script issue;
set
set -x
For cPanel, you may want to test curl (in case it's installed on your server):
curl --silent --compressed http://www.your-domain.com/cron.php
So it should look similar to: http://grabilla.com/0450d-93d93a32-02ab-457c-ac1c-d2883552a940.html#
You may also want to try removing the -q from your command and see if it helps.
* * * * * php /home/<username>/public_html/cron.php
*/1 * * * * /usr/bin/php -q /home//public_html/cron.php
Add the above line to the crontab file and run it . It will add a cronjob every minute

Categories