Cron job problem / Wordpress ? ?


Recommended Posts

I have used various different plugins to update my Twitter account automatically when one of my "scheduled" Wordpress posts is published. Most all of the plugins seem to, eventually, encounter the following problem:

I create and schedule, say, 24 hours of Wordpress posts to be published every 5 minutes. Well, I might check the Twitter page the plugin is to send the posts to 10 hours later and I see that the last post was 37 minutes ago, or something. The point is that I have them scheduled for every 5 minutes. Anyway, most of the time I refresh the Twitter page 5 or 6 times; yet, the missing posts do not display.

Here is where it, to me, gets odd. Virtually 100% of the time if I go to my website itself and refresh or open a page I will see that the missing posts have been posted every 5 minutes, as I scheduled them, to my website itself. If I then go back to the Twitter page and refresh the missing posts then display. However, they appear to have all been posted at the same time when I refreshed my Wordpress website or logged in to wp-admin. So, the posts get published to my Wordpress website every 5 minutes like they should, but the plugin, or something, seems to "cache" the posts instead of sending them every 5 minutes to Twitter. It is only when I open my Wordpress website or it's wp-admin do they actually get sent, but they appear to get sent all at once and the Twitter people may not like that at all.

There have been times when my, every 5 minute Wordpress posts, have not been sent to Twitter in more than an hour, but right after I open the wordpress site itself, or it's wp-admin, then all the missing posts get sent to Twitter at once. Can anyone give me a suggestion to resolve this issue?

I have used a number of different plugins to send my Wordpress website posts to Twitter and they all seem to eventually exhibit this behavior. Some of the plugin author's do admit to "sharing" some of the code.

note: This particular website has, essentially, zero traffic so it does not seem inconceivable to me that no visitors to the website exist to "trip" the "missing posts" to get sent to Twitter. The posts definitely get sent when I login to wp-admin, but I am pretty sure just visiting the home page of the website itself has the same affect.

{As a matter of fact this behavior is happening right now, as I type this. I looked at my Twitter page and the last post says "23 minutes ago..." . I created and scheduled several 100 posts to be published every 5 minutes. The posts should not stop until about 20 hours from now. I am going to intentionally try to wait another 15 minutes and then refresh the Twitter page without going to my website or it's wp-admin before that time period is up. I want to, again, make sure I am not misinterpreting the problem. Again, usually the posts will be sent to Twitter just fine for some time, maybe even many hours, but eventually they stop in the way I have described here.}

Can anyone give me a suggestion to resolve this issue?

UPDATE: I waited until the Twitter page said the last post was sent "about an hour ago" and then, without logging in to wp-admin, I went to the homepage of my Wordpress website. When my website's homepage 1st opened the posts were "missing" on the website as well. I refreshed one time, maybe twice, and then all of the missing posts displayed on my website. I then went to my Twitter page and refreshed once and something like 12 posts from my website showed up all at once. I do not think the Twitter people will like that.

Can someone point me in the right direction on this? Something, must be stopping the scheduled posts from being sent.

Edited by 32209
Link to comment
Share on other sites

It sounds like wp-cron is not being run at all. I assume you are receiving traffic to the web site? The fact you visiting pages makes me thinking wp-cron is not running though as stuff just starts showing up when you do. I'm not familiar if there is a setting that would make it not run unless an admin views it or what. I'd probably check the error_log file wherever the wordpress blog is installed as well for errors.

You could also prove that it's the wp-cron.php not being run by adding a cron via curl in cPanel and seeing if it resolves the issue.

Link to comment
Share on other sites

Well, I had downgraded from WP 2.9 previously, due to:

"The most sense that would make is your blog was upgraded to 2.9. That is a bug in wordpress / PHP that recently was discovered once 2.9 was released. Wordpress has already released 2.9.1 beta which fixes this but I have no idea on a stable release. As far as the PHP side of things they released PHP 5.2.12 to fix it but we have not properly tested that version yet to deploy it on our systems."

I have already backed up the site and upgraded to WP 2.9.1 . I will try to wait an hour or so to determine if WP 2.9.1 behaves the same way.

UPDATE: So far the problem is occurring in WP 2.9.1 as well. One post from my website to Twitter was missing on the Twitter page. When I refreshed my website's home page and then went back and refreshed the Twitter page the post to Twitter appeared. INCIDENTALLY, I have switched to another Wordpress Twitter update plugin and the same problem is occurring. In other words, I was running an entirely different Twitter update plugin when the last Twitter posts were missing before this one.

Edited by 32209
Link to comment
Share on other sites


OK, I think I want to add a cron via curl to visit http://*******.com/wp-cron.php

Is the following correct?

command to run: curl http://*******.com/wp-cron.php

{the following date / times are highlighted}

every minute

every hour

every day

every month

every weekday

DO I NEED TO ENTER AN EMAIL ADDRESS OR CAN I LEAVE IT AS " liaristc " WHICH IS WHAT THE " Please enter an email address where output from commands run via crontab will be sent: " is prepopulated with.

I made a TICKET with Hawkhost support regarding this issue. They replied and I asked them the same thing I am asking Tony here.

I am not sure how often I need the cron to visit wp-cron.php in order to keep my scheduled posts going at the 5 minute, or whatever, intervals that I want them to. Ideally, I would like to cron visit wp-cron.php ONLY enough to keep my scheduled Wordpress website posts sending to Twitter at the times I want, but I do not know how to determine the number of times per hour I need cron to run to do that.

UPDATE: Well, this seems to have resolved the issue with, at least, one plugin, the plugin I am using now. About 60 updates to Twitter appear to have been sent every 5 minutes for the last, well, 5 hours. This looks like "pinging" the server to me. Now I want to know the least amount of curl cron visits I can use and keep cron / wp-cron sending my blog updates to Twitter at the times I schedule, 5 minutes or whatever. Right now I have curl cron scheduled every 1 minute, but I do not want to do it way more than I need to and use up bandwidth; although, wp-cron.php comes up blank so I presume the bandwidth use is negligible.

Edited by 32209
Link to comment
Share on other sites

I'd leave the email blank unless you want output. As for the cron command itself:

curl --silent --compressed

You can set it every minute or 5 it does not matter. It's bandwidth usage is negligible I imagine. It won't run things more often or anything like that since it has it's own internal timers for the tasks it's running.

Link to comment
Share on other sites

Most of the plugins did not have the following issue; however, this is the plugin that is working now and it does. It appears to be the same issue that caused me to downgrade from WP 2.9; however, as I mentioned in this thread, this issue was present before I upgraded to WP 2.9.x in the last 12 hours, or so. Is this that same PHP issue still not resolved?

The posts are still being made to Twitter, though. Aside from error messages like the following, and significant annoyance, can you tell me what harm this is doing SINCE the posts are being made despite the error? :

Warning: curl_setopt() [function.curl-setopt]: CURLPROTO_FILE cannot be activated when in safe_mode or an open_basedir is set in /home/example/public_html/wp-content/plugins/tweetly-updater/ on line 86

Warning: curl_setopt() [function.curl-setopt]: CURLPROTO_FILE cannot be activated when in safe_mode or an open_basedir is set in /home/example/public_html/wp-content/plugins/tweetly-updater/ on line 116

Warning: Cannot modify header information - headers already sent by (output started at /home/example/public_html/wp-content/plugins/tweetly-updater/ in /home/example/public_html/wp-includes/pluggable.php on line 865


Your Twitter account details

Twitter login

Warning: curl_setopt() [function.curl-setopt]: CURLPROTO_FILE cannot be activated when in safe_mode or an open_basedir is set in /home/example/public_html/wp-content/plugins/tweetly-updater/ on line 86

Link to comment
Share on other sites

Tony are you telling me to specifically type in " curl --silent --compressed " instead of the " curl " that I am using now?

I ask because the plugin IS working now. Scheduled Wordpress posts are being sent to Twitter. I am hesitant to change the command, mostly, because I wasted/spent far more time trying to resolve this issue than I am comfortable with. I don't necessarily want to change the command, right this minute, and risk "breaking" the plugin/wp-cron again.

Link to comment
Share on other sites

...something specific to what the plugin you use is doing.

You are probably correct. When I get the error message(s) the plugin / wordpress still seems to do what I wanted; so, what I really want to know is is it doing any harm.

I have the plugin / wordpress doing (sending blog posts to Twitter) something that is important to me for, at least, the next couple of days.

If the error messages are benign, other than the annoyance, I may wait a while before I try to replace this particular plugin.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.