Knowledgebase
crontab issue on wordpress
Posted by tarek009187, 12-19-2014, 02:20 PM | Hi,
i m running a wordpress site mainly as a website which will be used less for blog perpose. when i checked my server, wp-cron.php was consuming log of cpu usage so i disabled it simply adding the following line in wp-config.php
now its no more consuming any cpu usage like before.
now the issue is, how can i set cron job for my server to with 6 hours interval?
the easiest method i found is from crontab-generator.org to generate crontab command for that time interval but i couldn't figure out one thing. what should be in "Command To Execute"?
will it be like this?
"/usr/bin/crontab /var/www/html/wp-cron.php"
some details i can provide
/usr/bin/crontab
and
total 8.0K
drwx-wx--T 2 root crontab 4.0K Feb 9 2013 .
drwxr-xr-x 5 root root 4.0K Apr 17 2014 ..
another thing,
when i run crontab -e the file that opens in putty is
/tmp/crontab.KUBbog/crontab
also when i exit with command ctrl-X,this massage appears
no crontab for root - using an empty one
No modification made
could someone assis me on this issue? i really don't have any further idea how to set it.
|
Posted by edigest, 12-19-2014, 02:37 PM | You must use "crontab -e" to add a cron job. "crontab -l" shows what crons are set.
To add your WP cron, try adding this:
* */6 * * * /usr/bin/curl http:///wp-cron.php?doing_wp_cron >/dev/null 2>&1
|
Posted by tarek009187, 12-19-2014, 06:48 PM | edigest
thanks a lot for your reply guru.
need some more assistance here.
previously i generated one cron job from crontab-generator.org by using command to execute "php -q /var/www/html/wp-cron.php"
and got the following code
0 * * * 0,1,2,3,4,5,6 php -q /var/www/html/wp-cron.php >/dev/null 2>&1
however i had added the above code on the last line on the crontab file that opens by command crontab -e
now when i went to change to the code you gave, surprised to see that line is not in that file anymore.
also crontab -l shows
no crontab for root - using an empty one
i believe i have done something wrong there. is it because i did all those operation with another user, not with root
or i did clear page cache in w3tc. thats why its deleted. but it doesn't make sense that it happens for w3tc. maybe i did somethin gwrong somewhere else.
i need your expert comments here badly.
and by the way,
in mydomain will it be like this
* */6 * * * /usr/bin/curl http://mydomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
or
* */6 * * * /usr/bin/curl /var/www/html/wp-cron.php?doing_wp_cron >/dev/null 2>&1
and do i have to restart something after adding that line to crontab?
Last edited by tarek009187; 12-19-2014 at 06:55 PM.
|
|
Add to Favourites
Print this Article |
Also Read