Set up new cron job using WP CLI in local

I am trying to set up new Cron job for CiviCRM using WP CLI command line in the Local Shell

The instructions from CiviCRM are as follows:
$ /path/to/wp-cli
–user=cronuser
–url=http://example.org
–path=/var/www/example.org/
civicrm api job.execute auth=0



System Details Windows 10

  • **Local Version: 9.1.0-windows

  • Operating System (OS) and OS version:



Hi @CBooth

So you’re setting this up in CiviCRM?

Are you getting any errors or what specific is the issue?

I gave up trying to follow the CivCRM Manual, and installed EasyCron and followed a their instructions ( How to set up cron job for CiviCRM ) and received the following error
Post “http://241017-sandpit.local/wp-content/plugins/civicrm/civicrm/bin/cron.php”: dial tcp: lookup 241017-sandpit.local: no such host
(before starting I up I disabled cron in wp-config.php)

I tred increassing the timout, and whitelisting all EasyCron IP adresses (in Windows firewall) - but no luck!

They error seems like it might still be getting blocked somehow. Could you try disabling the firewall temporarily to see if it works? Do you have any other antivirus or security features on your machine or the site?

It looks like CiviCRM also has their own community so I wonder if they might have any more information on getting things working Locally.

Thanks Nick. One suggestion is that I need to bind my site to a static IP (or use dynamic domain) in order to let EasyCron find it. I dont know how to do this.

Do you know how I can bind the static IP address to my Local WP site?

I am using a VPN with a static IP address.
I just tried turning off my firewall and anti-virus software - still not working and the same error message: “dial tcp: lookup 241017-sandpit.local: no such host”

No help from the Civi community, yet.

I’ve never tried this on Windows @CBooth but I think you could try this:

  • Open Notepad as Administrator.
  • Open the hosts file located at C:\Windows\System32\drivers\etc\hosts.
  • Add a line like:
[STATIC_IP] yourdomain.local

Replace [STATIC_IP] with your VPN’s static IP and yourdomain.local with the local site address you’re using.

  • Save the file and try reloading the local domain.

Thank you Nick. Unfortunately, this didn’t work either. Localhost always reverts back to the same IP address when I reload the local domain, even after I have changed it to my VPN static IP address in the hosts system file. 127.0.0.1 seems to be a default setting.

::1 www.241017-sandpit.local #Local Site
127.0.0.1 www.241017-sandpit.local #Local Site

I think I may need to give up at this point. But thank you for being so helpful!

1 Like

No problem @CBooth I understand doing what is best with your time here! Thank you for your patience and communication. I’ll leave this thread open for now in case another user pops by in the future who has more familiarity with setting this up.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.