I have a bash script with various WP-CLI commands to run a backup, check & optimize db tables, run a security vulnerability check, check available core, plugin, and theme updates, and then email the report to me.
If I run this script from the command line, it works perfectly. However, if I schedule a cronjob, the script runs, but the output for all WP commands are as such:
/usr/local/bin/dev-maintenance-check.bash: line 70: wp: command not found
I've tried various different cron job formats to no avail. This is the current cronjob:
0 1 * * 0,3 bash /usr/local/bin/dev-maintenance-check.bash
My WP-cli installation is at usr/local/bin/wp. Again, if I run "bash /usr/local/bin/dev-maintenance-check.bash" in the command line, that works.
To me, it sounds like the wp-cli needs to be called in the script. I feel confident that I've exhausted my search on Google on the wp-cli docs. Any help would be appreciated.