Mautic Community Forums

Normal cron job output?

Hi,



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:

Code:
php /home2/elifeone/public_html/menoraway/mautic/app/console --env prod -n mautic:leadlists:update

It outputs:
Code:
Mautic version 1.1.3 - app/prod

Usage:
[options] command [arguments]

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 ?

Hi,

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:

php /home2/elifeone/public_html/menoraway/mautic/app/console --env prod -n mautic:leadlists:update

It outputs:

[code]Mautic version 1.1.3 - app/prod

Usage:
[options] command [arguments]

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[/code]

How can I (easily) tell if the job is working properly ?

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)?

OK, on further investigation I found there’s another PHP command installed that’s meant for command-line use - php-cli. So my new cron jobs look like:

php-cli .../mautic/app/console mautic:leadlists:update  --env prod >.../mautic/app/console.leadlists-update.cron.log 2>&1

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.