I created a new cusotm WP CLI command, but I did not use the wp_schedule_event or anything. When I deployed my new code to staging, it started running this cron job every 15 minutes when the default trellis wp-cron runs.
Why is that? While that’s the schedule I’ll probably want this running on, I have another WP CLI command I am going to create I want run once a day. How do I set the schedule for two new commands I am adding to WP CLI?
I am struggling a little bit with Cron because I’m using a plugin that seems really great called WP Ultimate CSV Importer Pro to import/update some CPTs based on a CSV that a little python script is converting from a Google Spreadsheet, run nightly via cron.
I want to enable Cron on the Staging Server for testing purposes which I have done by adding the following line to group_vars/staging/wordpress_sites.yml:
I see that the vault_wordpress_sites[site].env, project.env and wordpress_env_defaults in roles/deploy/vars/main.yml are merged to generate the site_env dictionary:
Enable which cron? By default Trellis uses system cron instead of the built-in WP one. If you want system cron, you don’t need to do anything. So I’m assuming you want WP cron instead?
As for the other questions:
project.env is what you set in group_vars/staging/wordpress_sites.yml.
vault_wordpress_sites[site].env comes from the equivalent site in the vault file: group_vars/staging/vault.yml.
So we start with the defaults, then merge in your project specific ones, then merge in any ones in the vault as the final step.
Anyway, judging from that log output, it looks like system cron is still running. Assuming those timestamps are after you provisioned again?
This should result in absent. However, I’m not sure we’re restarting cron (or if we need to) . You can try service crond restart or whatever it is.
Now I’m just confused. Before you were trying to set disable_wp_cron: false.
If the plugin dev is recommending using crontab anyway, why are you disabling it? Trellis’ default should be fine and you already had it working fine (judging from your logs).
Dude, I’m the one who’s confused! I think i get now that when we talk about disabling the Wordpress Cron, we mean usually mean disabling whatever php-based timing system WP uses by default and triggering WP Cron tasks from the Server Cron. Maybe some people just run all the WP Cron manually.
At any rate, I think I get it now, thanks you you, as usual.
Man, is Ansible/Trellis dope! Loving tags.
I can confirm that their cron events can run succesfully:
$ wp cron event run --due-now
Executed the cron event 'smack_uci_cron_scheduler' in 0.005s.
Executed the cron event 'smack_uci_cron_scheduled_export' in 0.002s.
Executed the cron event 'smack_uci_email_scheduler' in 0.003s.
Executed the cron event 'smack_uci_replace_inline_images' in 0.003s.
Executed the cron event 'smack_uci_image_scheduler' in 0.003s.
So I don’t think it’s my server configuration. Now just need to figure out what is wrong.