I was setting up the cron job on my bluehost shared account, and when there is output from the cron jobs it emails it to me. I was thinking my cron job is broken because it just emails me the command line usage every time the job runs. Should I pipe this to /dev/null or does that mean there is an error? I tried editing the command line in different ways, but never got anything better than that.
Here’s an example of one of the cron job command lines that does this:
Options:
–help -h Display this help message
–quiet -q Do not output any message
–verbose -v|vv|vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
–version -V Display this application version
–ansi Force ANSI output
–no-ansi Disable ANSI output
–no-interaction -n Do not ask any interactive question
… more usage options …
Set-Cookie: ; path=/
Content-type: text/html
How can I (easily) tell if the job is working properly ?
I was setting up the cron job on my bluehost shared account, and when there is output from the cron jobs it emails it to me. I was thinking my cron job is broken because it just emails me the command line usage every time the job runs. Should I pipe this to /dev/null or does that mean there is an error? I tried editing the command line in different ways, but never got anything better than that.
Here’s an example of one of the cron job command lines that does this:
Options:
–help -h Display this help message
–quiet -q Do not output any message
–verbose -v|vv|vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
–version -V Display this application version
–ansi Force ANSI output
–no-ansi Disable ANSI output
–no-interaction -n Do not ask any interactive question
OK, I think I figured it out. Bluehost is probably setting the register_argc_argv setting off in php.ini. So the arguments are not given to the script. I discovered on Stack Overflow that using php -n somehow makes this work. Now the output is “Mautic is not set to queue email.” rather than the usage documentation.
I do think it would be helpful (if there isn’t something like that already) to have a kind of health check somewhere for the cron jobs.
Is there anything in the php.ini I would want to have set for Mautic to work ? Or is it OK to just use php -n (which means don’t load any php.ini at all)?
This still loads all the options from php.ini and yet also support command-line parameters and doesn’t dump out any HTTP headers.
Also, I can look at the output of the script in the log file I’m piping things to. The modification date of the file tells me the last time the job was run.