Blog

Fix WordPress “Missed schedule” error on Media Temple (dv) / Plesk

After a lot of debugging, I was able to figure out that Media Temple’s (dv) configuration was responsible for the “Missed schedule” errors I was getting in WordPress.  By default, the /etc/hosts file looks like this:

127.0.0.1  yourdomain.com yourdomain localhost localhost.localdomain

To execute cron tasks, WordPress needs to post to the URL http://yourdomain.com/wp-cron.php?doing_wp_cron. This isn’t usually a problem, but with the above hosts file and Plesk’s Apache configuration, that URL will actually result in a 404 error.

I tried removing yourdomain.com and youdomain from the hosts file:

127.0.0.1  localhost localhost.localdomain
Unfortunately, when you restart the VPS using Virtuozzo in Plesk, yourdomain.com and yourdomain will just be added back in.  However, after some exhausting Google searching I found out that you can just move them down to the next line with the proper IP address:
127.0.0.1  localhost localhost.localdomain
xxx.xxx.xxx.xxx yourdomain.com yourdomain

Now when you restart the VPS, these changes to the hosts file will remain.

I looked at several other possible solutions to fix the “Missed schedule” problem.  One solution was setting the “ALTERNATE_WP_CRON” constant in the wp-config.php:

define('ALTERNATE_WP_CRON', true);

This activated some very messy redirecting for the user as they browsed the site though.  Not a great solution.  Another solution I was considering was just executing wp-cron.php from a cronjob every hour. Something like this:

0 * * * * /home/yourdomain/htdocs/wp-cron.php >/dev/null
  • http://williejackson.com Willie Jackson

    1. That comment preview feature is sliiiiiick. Nice!
    2. This is exactly what I was looking for. I’ll be testing it out this week. Thanks for taking the time to post the solution.

  • http://www.askwhiz.com Ask Questions

    Does adding a some cron job help? I got a lot of blogs where i schedule posts. Now i have to keep checking and publishing them. Its made life difficult.

  • http://bradt.ca/ bradt

    Yes, scheduling wp-cron.php to run as a cron job on the server could work as well.

  • Derek

    I have two domains on my (dv) account, one for my main site and the other for anything else. Which IP should I be adding there?

    Also, I have a crontab running it now, but since I use super cache I get an error email so I would really like to get this working.

  • http://bradt.ca/ bradt

    @Derek If you don’t know the IP addresses for your domains, you should contact Media Temple for support.

  • http://valendesings.com Derek

    I know what my IP’s are, that wasn’t my question. My question was which one do I use?

  • http://bradt.ca/ bradt

    @Derek If you have two domains with two IP addresses, and your /etc/hosts currently looks like this:

    127.0.0.1 yourdomain1.com yourdomain1 yourdomain2.com yourdomain2 localhost localhost.localdomain

    You could try something like this:

    127.0.0.1 localhost localhost.localdomain
    ip_address1 yourdomain1.com yourdomain1
    ip_address2 yourdomain2.com yourdomain2
    

    If you share 1 ip address between your two domains, you could try:

    127.0.0.1 localhost localhost.localdomain
    ip_address yourdomain1.com yourdomain1 yourdomain2.com yourdomain2
    
  • Derek

    I actually have my main domain on one IP and the other 10 or so sharing the other IP. I’ll try and ask MT and see what they say about it.

  • Emily

    Just wanted to thank you for posting this fix, in particular the part about moving the hostname to a second line! Saved me. Cheers.

  • Pingback: (dv) – Shawn Blanc()

  • Pingback: Hosts file entries for multiple domains on VPS? - Admins Goodies()

  • Pingback: Wordpress: “Missed Schedule” Problem bei Posts beheben » Admins Werk()

  • http://x2nation.com X2 Nation

    Wish I searched for this a couple hours ago :-) …Thanks for posting this you saved me a ton of time Cheers, Robert @ X2

  • Adrián

    Big Thanks! I don’t know if I have to: Like, +1, Tweet, Share, Stumble Upon, Digg or what this article, but was exactly what I need to know.

    Although my “trouble” was using CloudFlare, this workaround fits perfectly

  • Pingback: How to Replace WordPress Cron With A Real… « Riz Notes()

  • http://shashitechno.com Shashikant Vaishnav

    Hello guys,

    I am frustrate from last 7 days as crons not
    working for me at all. Although I see in the access logs they comes with
    response code 200.

    On my server there is two word press installation in different folders. Say domain.com/xyz1, domain.com/xyz2

    And here is how the host file looks –

    127.0.0.1 localhost.localdomain localhost
    186.202.153.11 hm6482.locaweb.com.br hm6482

    Any idea what’s going wrong ?

Comments Elsewhere