I can not get launchd to run a shell script. Even a very basic script.
I'm using MacOS Sonoma in a Parallels VM. I have a development version of WordPress running in that VM, and everything works great. But I'm trying to get launchd to run a script every 5 minutes, but it will not run the script. It returns a 1 result, but no explanation of what the problem is.
I am able to get the plist to do something very basic every 5 minutes, so there isn't a problem with the plist running. But if I try to get it to run a script, the script never runs.
<key>ProgramArguments</key>
<array>
<string>/bin/zsh</string>
<string>/Users/devuser/scripts/strokewpcron.zsh</string>
</array>
The script is never called. Inside the script I have paths to things spelled out completely:
#!/bin/zsh
{
echo "$(date '+%Y:%m:%d %H:%M:%S') - Script started"
if /usr/bin/pgrep nginx >/dev/null 2>&1 ; then
echo "Nginx is running, proceeding with wget"
/usr/local/bin/wget --no-check-certificate 'https://mydevsite.com/wp-cron.php?doing_wp_cron' 2>&1
else
echo "Nginx is not running"
fi
echo "$(date '+%Y:%m:%d %H:%M:%S') - Script ended"
} >> /Users/devuser/Desktop/nginx-logs/wpStroke.log 2>&1
I am doing something wrong.